Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Poirier <theeth@yahoo.com>2009-11-11 06:45:26 +0300
committerMartin Poirier <theeth@yahoo.com>2009-11-11 06:45:26 +0300
commitf7d71499369fabc19ebc46ca723b6437943005de (patch)
tree2957cf841be47f100f79a599ccbf88b5e5e17fd9 /intern/guardedalloc/intern/mallocn.c
parentf0fc007c4b4bde845610d93cbae9c3c4a86a1216 (diff)
Debug tools: new function MEM_testN(void*)
returns 0 if pointer is not in memlist
Diffstat (limited to 'intern/guardedalloc/intern/mallocn.c')
-rw-r--r--intern/guardedalloc/intern/mallocn.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c
index ecf89c894d2..d1114af2437 100644
--- a/intern/guardedalloc/intern/mallocn.c
+++ b/intern/guardedalloc/intern/mallocn.c
@@ -478,6 +478,29 @@ void MEM_callbackmemlist(void (*func)(void*)) {
mem_unlock_thread();
}
+short MEM_testN(void *vmemh) {
+ MemHead *membl;
+
+ mem_lock_thread();
+
+ membl = membase->first;
+ if (membl) membl = MEMNEXT(membl);
+
+ while(membl) {
+ if (vmemh == membl+1)
+ return 1;
+
+ if(membl->next)
+ membl= MEMNEXT(membl->next);
+ else break;
+ }
+
+ mem_unlock_thread();
+
+ print_error("Memoryblock %p: pointer not in memlist\n", vmemh);
+ return 0;
+}
+
void MEM_printmemlist( void ) {
MEM_printmemlist_internal(0);
}
@@ -518,7 +541,6 @@ short MEM_freeN(void *vmemh) /* anders compileertie niet meer */
}
mem_lock_thread();
-
if ((memh->tag1 == MEMTAG1) && (memh->tag2 == MEMTAG2) && ((memh->len & 0x3) == 0)) {
memt = (MemTail *)(((char *) memh) + sizeof(MemHead) + memh->len);
if (memt->tag3 == MEMTAG3){