fix for memory leak: node animation data wasnt being free'd

also some corrections to memory debug stuff.
This commit is contained in:
Campbell Barton
2010-02-13 13:38:10 +00:00
parent 4be8384e27
commit 39c3ebdc91
3 changed files with 9 additions and 5 deletions

View File

@@ -305,9 +305,9 @@ void *MEM_mallocN(unsigned int len, const char *str)
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 @@ void *MEM_callocN(unsigned int len, const char *str)
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 @@ void *MEM_mapallocN(unsigned int len, const char *str)
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);
}

View File

@@ -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 @@ void ntreeFreeTree(bNodeTree *ntree)
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) {

View File

@@ -5307,7 +5307,7 @@ static BHead *read_data_into_oldnewmap(FileData *fd, BHead *bhead, char *allocna
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 @@ static BHead *read_data_into_oldnewmap(FileData *fd, BHead *bhead, char *allocna
strcpy(tmp, allocname);
data= read_struct(fd, bhead, tmp);
#endif
#else
data= read_struct(fd, bhead, allocname);
#endif
if (data) {
oldnewmap_insert(fd->datamap, bhead->old, data, 0);