forked from bartvdbraak/blender
New function:
void MEM_callbackmemlist(void (*func)(void*)); Will call the function passed as argument with all allocated address as parameter. Useful for debuging.
This commit is contained in:
parent
91446e9aad
commit
21385eb4ec
@ -102,6 +102,9 @@ extern "C" {
|
||||
* blocks. */
|
||||
void MEM_printmemlist(void);
|
||||
|
||||
/** calls the function on all allocated memory blocks. */
|
||||
void MEM_callbackmemlist(void (*func)(void*));
|
||||
|
||||
/** Print statistics about memory usage */
|
||||
void MEM_printmemlist_stats(void);
|
||||
|
||||
|
@ -460,6 +460,24 @@ static void MEM_printmemlist_internal( int pydict )
|
||||
mem_unlock_thread();
|
||||
}
|
||||
|
||||
void MEM_callbackmemlist(void (*func)(void*)) {
|
||||
MemHead *membl;
|
||||
|
||||
mem_lock_thread();
|
||||
|
||||
membl = membase->first;
|
||||
if (membl) membl = MEMNEXT(membl);
|
||||
|
||||
while(membl) {
|
||||
func(membl+1);
|
||||
if(membl->next)
|
||||
membl= MEMNEXT(membl->next);
|
||||
else break;
|
||||
}
|
||||
|
||||
mem_unlock_thread();
|
||||
}
|
||||
|
||||
void MEM_printmemlist( void ) {
|
||||
MEM_printmemlist_internal(0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user