[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26869] trunk/blender: fix for memory leak : node animation data wasnt being free'd
Campbell Barton
ideasman42 at gmail.com
Sat Feb 13 14:38:12 CET 2010
Revision: 26869
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26869
Author: campbellbarton
Date: 2010-02-13 14:38:10 +0100 (Sat, 13 Feb 2010)
Log Message:
-----------
fix for memory leak: node animation data wasnt being free'd
also some corrections to memory debug stuff.
Modified Paths:
--------------
trunk/blender/intern/guardedalloc/intern/mallocn.c
trunk/blender/source/blender/blenkernel/intern/node.c
trunk/blender/source/blender/blenloader/intern/readfile.c
Modified: trunk/blender/intern/guardedalloc/intern/mallocn.c
===================================================================
--- trunk/blender/intern/guardedalloc/intern/mallocn.c 2010-02-13 13:17:15 UTC (rev 26868)
+++ trunk/blender/intern/guardedalloc/intern/mallocn.c 2010-02-13 13:38:10 UTC (rev 26869)
@@ -305,9 +305,9 @@
memset(memh+1, 255, len);
#ifdef DEBUG_MEMCOUNTER
- memh->_count= _mallocn_count++;
if(_mallocn_count==DEBUG_MEMCOUNTER_ERROR_VAL)
memcount_raise("MEM_mallocN");
+ memh->_count= _mallocn_count++;
#endif
return (++memh);
}
@@ -330,9 +330,9 @@
make_memhead_header(memh, len, str);
mem_unlock_thread();
#ifdef DEBUG_MEMCOUNTER
- memh->_count= _mallocn_count++;
if(_mallocn_count==DEBUG_MEMCOUNTER_ERROR_VAL)
memcount_raise("MEM_callocN");
+ memh->_count= _mallocn_count++;
#endif
return (++memh);
}
@@ -372,9 +372,9 @@
mmap_in_use += len;
mem_unlock_thread();
#ifdef DEBUG_MEMCOUNTER
- memh->_count= _mallocn_count++;
if(_mallocn_count==DEBUG_MEMCOUNTER_ERROR_VAL)
memcount_raise("MEM_mapallocN");
+ memh->_count= _mallocn_count++;
#endif
return (++memh);
}
Modified: trunk/blender/source/blender/blenkernel/intern/node.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/node.c 2010-02-13 13:17:15 UTC (rev 26868)
+++ trunk/blender/source/blender/blenkernel/intern/node.c 2010-02-13 13:38:10 UTC (rev 26869)
@@ -57,6 +57,7 @@
#include "BKE_texture.h"
#include "BKE_text.h"
#include "BKE_utildefines.h"
+#include "BKE_animsys.h" /* BKE_free_animdata only */
#include "BLI_math.h"
#include "BLI_blenlib.h"
@@ -1343,6 +1344,8 @@
ntreeEndExecTree(ntree); /* checks for if it is still initialized */
+ BKE_free_animdata((ID *)ntree);
+
BLI_freelistN(&ntree->links); /* do first, then unlink_node goes fast */
for(node= ntree->nodes.first; node; node= next) {
Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c 2010-02-13 13:17:15 UTC (rev 26868)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c 2010-02-13 13:38:10 UTC (rev 26869)
@@ -5307,7 +5307,7 @@
while(bhead && bhead->code==DATA) {
void *data;
-#if 0
+#if 0
/* XXX DUMB DEBUGGING OPTION TO GIVE NAMES for guarded malloc errors */
short *sp= fd->filesdna->structs[bhead->SDNAnr];
char *allocname = fd->filesdna->types[ sp[0] ];
@@ -5315,8 +5315,9 @@
strcpy(tmp, allocname);
data= read_struct(fd, bhead, tmp);
+#else
+ data= read_struct(fd, bhead, allocname);
#endif
- data= read_struct(fd, bhead, allocname);
if (data) {
oldnewmap_insert(fd->datamap, bhead->old, data, 0);
More information about the Bf-blender-cvs
mailing list