[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49625] branches/soc-2011-tomato/source: fix for memory leak playing animations.
Campbell Barton
ideasman42 at gmail.com
Mon Aug 6 17:54:52 CEST 2012
Revision: 49625
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49625
Author: campbellbarton
Date: 2012-08-06 15:54:52 +0000 (Mon, 06 Aug 2012)
Log Message:
-----------
fix for memory leak playing animations.
Modified Paths:
--------------
branches/soc-2011-tomato/source/blender/windowmanager/intern/wm_playanim.c
branches/soc-2011-tomato/source/creator/creator.c
Modified: branches/soc-2011-tomato/source/blender/windowmanager/intern/wm_playanim.c
===================================================================
--- branches/soc-2011-tomato/source/blender/windowmanager/intern/wm_playanim.c 2012-08-06 15:22:19 UTC (rev 49624)
+++ branches/soc-2011-tomato/source/blender/windowmanager/intern/wm_playanim.c 2012-08-06 15:54:52 UTC (rev 49625)
@@ -941,6 +941,9 @@
pupdate_time();
ptottime = 0;
+ /* newly added in 2.6x, without this images never get freed */
+#define USE_IMB_CACHE
+
while (ps.go) {
if (ps.pingpong)
ps.direction = -ps.direction;
@@ -967,8 +970,9 @@
if (ptottime > 0.0) ptottime = 0.0;
while (ps.picture) {
+#ifndef USE_IMB_CACHE
if (ibuf != NULL && ibuf->ftype == 0) IMB_freeImBuf(ibuf);
-
+#endif
if (ps.picture->ibuf) {
ibuf = ps.picture->ibuf;
}
@@ -984,6 +988,11 @@
}
if (ibuf) {
+
+#ifdef USE_IMB_CACHE
+ ps.picture->ibuf = ibuf;
+#endif
+
BLI_strncpy(ibuf->name, ps.picture->name, sizeof(ibuf->name));
/* why only windows? (from 2.4x) - campbell */
@@ -1101,7 +1110,10 @@
#endif /* WITH_QUICKTIME */
/* cleanup */
+#ifndef USE_IMB_CACHE
if (ibuf) IMB_freeImBuf(ibuf);
+#endif
+
BLI_freelistN(&picsbase);
#if 0 // XXX25
free_blender();
@@ -1115,7 +1127,10 @@
totblock = MEM_get_memory_blocks_in_use();
if (totblock != 0) {
+ /* prints many bAKey, bArgument's which are tricky to fix */
+#if 0
printf("Error Totblock: %d\n", totblock);
MEM_printmemlist();
+#endif
}
}
Modified: branches/soc-2011-tomato/source/creator/creator.c
===================================================================
--- branches/soc-2011-tomato/source/creator/creator.c 2012-08-06 15:22:19 UTC (rev 49624)
+++ branches/soc-2011-tomato/source/creator/creator.c 2012-08-06 15:54:52 UTC (rev 49625)
@@ -1270,11 +1270,6 @@
BLI_threadapi_init();
- RNA_init();
- RE_engines_init();
-
- init_nodesystem();
-
initglobals(); /* blender.c */
IMB_init();
@@ -1295,6 +1290,15 @@
BLI_argsParse(ba, 1, NULL, NULL);
#endif
+
+ /* after level 1 args, this is so playanim skips RNA init */
+ RNA_init();
+
+ RE_engines_init();
+ init_nodesystem();
+ /* end second init */
+
+
#if defined(WITH_PYTHON_MODULE) || defined(WITH_HEADLESS)
G.background = 1; /* python module mode ALWAYS runs in background mode (for now) */
#else
More information about the Bf-blender-cvs
mailing list