ec0190adb0
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.
41 lines
1.0 KiB
C
41 lines
1.0 KiB
C
/*
|
|
* Copyright 2010-2012 Haiku, Inc. All Rights Reserved.
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
#ifndef MALLOC_DEBUG_H
|
|
#define MALLOC_DEBUG_H
|
|
|
|
|
|
#include <OS.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
status_t heap_debug_start_wall_checking(int msInterval);
|
|
status_t heap_debug_stop_wall_checking();
|
|
|
|
void heap_debug_set_memory_reuse(bool enabled);
|
|
void heap_debug_set_paranoid_validation(bool enabled);
|
|
void heap_debug_set_debugger_calls(bool enabled);
|
|
void heap_debug_set_default_alignment(size_t defaultAlignment);
|
|
void heap_debug_validate_heaps();
|
|
void heap_debug_validate_walls();
|
|
|
|
void heap_debug_dump_allocations(bool statsOnly, thread_id thread);
|
|
void heap_debug_dump_heaps(bool dumpAreas, bool dumpBins);
|
|
|
|
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
|
|
}
|
|
#endif
|
|
|
|
#endif /* MALLOC_DEBUG_H */
|