package core.alloc.memdebug
The memory debugger allocator wraps an existing allocator (normally the heap allocator), and reports on a TCP socket all of the allocation operations done to the underlying allocator. This listener on this socket can use this information to show useful information about the memory usage in the program.
This is best used when it starts at the very beginning of the program. The easiest way to use this is to define MEMDEBUG in runtime.vars, or pass -DMEMDEBUG on the command line.
MemDebugStackNode :: struct {
file: [] u8;
line: u32;
current_line: u32;
func_name: [] u8;
}
MemDebugState :: struct {
wrapped_allocator: Allocator;
listen_addr: SocketAddress;
socket: ? Socket;
writer: ? Writer;
}
memdebug_proc :: (m: &MemDebugState, action: AllocationAction, size: u32, align: u32, oldptr: rawptr) -> rawptr