diff options
Diffstat (limited to 'intern/guardedalloc')
-rw-r--r-- | intern/guardedalloc/MEM_guardedalloc.h | 4 | ||||
-rw-r--r-- | intern/guardedalloc/intern/mallocn.c | 14 |
2 files changed, 18 insertions, 0 deletions
diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h index 6b78b0b6bdc..dfb8b2db1b1 100644 --- a/intern/guardedalloc/MEM_guardedalloc.h +++ b/intern/guardedalloc/MEM_guardedalloc.h @@ -150,6 +150,10 @@ extern "C" { /*get the peak memory usage in bytes, including mmap allocations*/ uintptr_t MEM_get_peak_memory(void); +#ifndef NDEBUG +const char *MEM_name_ptr(void *vmemh); +#endif + #ifdef __cplusplus } #endif diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c index 09f2d33a674..b213a1c3744 100644 --- a/intern/guardedalloc/intern/mallocn.c +++ b/intern/guardedalloc/intern/mallocn.c @@ -856,4 +856,18 @@ int MEM_get_memory_blocks_in_use(void) return _totblock; } +#ifndef NDEBUG +const char *MEM_name_ptr(void *vmemh) +{ + if (vmemh) { + MemHead *memh= vmemh; + memh--; + return memh->name; + } + else { + return "MEM_name_ptr(NULL)"; + } +} +#endif + /* eof */ |