[Bf-blender-cvs] [d358f1f] master: Fix last part of T38244: memory leak when scaling any panel

Bastien Montagne noreply at git.blender.org
Sun Jan 19 15:02:39 CET 2014


Commit: d358f1f9e7c1870049834842e6eecad93dcea731
Author: Bastien Montagne
Date:   Sun Jan 19 14:57:48 2014 +0100
https://developer.blender.org/rBd358f1f9e7c1870049834842e6eecad93dcea731

Fix last part of T38244: memory leak when scaling any panel

Issue is not noticeable with default font, but i18n one can use more than 500Mo of ram when cached in undreds of different sizes.

Campbell had already done most of the work in rBa780e7f3f09f and rB6b283f116829, just had to call BLF_cache_clear() in _exit funcs of VIEW2D_zoom & co operators.

===================================================================

M	source/blender/editors/interface/view2d_ops.c

===================================================================

diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index d39c834..d299b72 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -38,6 +38,8 @@
 #include "BLI_utildefines.h"
 #include "BLI_math_base.h"
 
+#include "BLF_api.h"
+
 #include "BKE_context.h"
 
 #include "RNA_access.h"
@@ -46,7 +48,6 @@
 #include "WM_api.h"
 #include "WM_types.h"
 
-
 #include "ED_screen.h"
 
 #include "UI_view2d.h"
@@ -663,6 +664,10 @@ static void view_zoomstep_apply(bContext *C, wmOperator *op)
 /* cleanup temp customdata  */
 static void view_zoomstep_exit(wmOperator *op)
 {
+	/* Fonts are stored at each DPI level, without this we can easy load 100's of fonts.
+	 * Not an issue with embedded font, but can use over 500Mo with i18n ones! See T38244. */
+	BLF_cache_clear();
+
 	if (op->customdata) {
 		MEM_freeN(op->customdata);
 		op->customdata = NULL;
@@ -894,6 +899,10 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op)
 /* cleanup temp customdata  */
 static void view_zoomdrag_exit(bContext *C, wmOperator *op)
 {
+	/* Fonts are stored at each DPI level, without this we can easy load 100's of fonts.
+	 * Not an issue with embedded font, but can use over 500Mo with i18n ones! See T38244. */
+	BLF_cache_clear();
+
 	if (op->customdata) {
 		v2dViewZoomData *vzd = op->customdata;




More information about the Bf-blender-cvs mailing list