[PATCH 2/2] dwrite: Release run info as soon as it's rendered to save some memory

Nikolay Sivov nsivov at codeweavers.com
Tue Aug 4 03:16:35 CDT 2015


---

-------------- next part --------------
>From 150f4a7211a60812ff982a2a3ecb96101f38ef22 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov at codeweavers.com>
Date: Tue, 4 Aug 2015 10:27:03 +0300
Subject: [PATCH 2/2] dwrite: Release run info as soon as it's rendered to save
 some memory

---
 dlls/dwrite/font.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c
index 707ef6d..aaa0f42 100644
--- a/dlls/dwrite/font.c
+++ b/dlls/dwrite/font.c
@@ -2907,7 +2907,8 @@ static ULONG WINAPI glyphrunanalysis_Release(IDWriteGlyphRunAnalysis *iface)
     TRACE("(%p)->(%u)\n", This, ref);
 
     if (!ref) {
-        IDWriteFontFace_Release(This->run.fontFace);
+        if (This->run.fontFace)
+            IDWriteFontFace_Release(This->run.fontFace);
         heap_free(This->glyphs);
         heap_free(This->advances);
         heap_free(This->offsets);
@@ -3088,6 +3089,20 @@ static void glyphrunanalysis_render(struct dwrite_glyphrunanalysis *analysis, DW
     IDWriteFontFace2_Release(fontface2);
 
     analysis->ready |= RUNANALYSIS_BITMAP;
+
+    /* we don't need this anymore */
+    heap_free(analysis->glyphs);
+    heap_free(analysis->advances);
+    heap_free(analysis->offsets);
+    IDWriteFontFace_Release(analysis->run.fontFace);
+
+    analysis->glyphs = NULL;
+    analysis->advances = NULL;
+    analysis->offsets = NULL;
+    analysis->run.glyphIndices = NULL;
+    analysis->run.glyphAdvances = NULL;
+    analysis->run.glyphOffsets = NULL;
+    analysis->run.fontFace = NULL;
 }
 
 static HRESULT WINAPI glyphrunanalysis_CreateAlphaTexture(IDWriteGlyphRunAnalysis *iface, DWRITE_TEXTURE_TYPE type,
-- 
2.1.4



More information about the wine-patches mailing list