malloc_debug: Implement allocation dump on exit in guarded heap.
When enabled (using heap_debug_dump_allocations_on_exit(true) or MALLOC_DEBUG=e) this causes a dump of all remaining allocations when libroot_debug is unloaded. It uses terminate_after to be called as late as possible. When combined with alloc stack traces this makes for a nice if a bit crude leak checker. Note that a lot of allocations usually remain even at that stage due to statically, lazyly and globally allocated stuff from the various system libraries where it isn't necessarily worth the overhead to free them when the program terminates anyway.
This commit is contained in:
@@ -30,6 +30,7 @@ void *heap_debug_malloc_with_guard_page(size_t size);
|
||||
status_t heap_debug_get_allocation_info(void *address, size_t *size,
|
||||
thread_id *thread);
|
||||
|
||||
status_t heap_debug_dump_allocations_on_exit(bool enabled);
|
||||
status_t heap_debug_set_stack_trace_depth(size_t stackTraceDepth);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user