Packages

builtin
cbindgen
core
core.alloc
core.alloc.arena
core.alloc.atomic
core.alloc.fixed
core.alloc.gc
core.alloc.heap
core.alloc.log
core.alloc.memdebug
core.alloc.pool
core.alloc.ring
core.arg_parse
core.array
core.avl_tree
core.bucket_array
core.conv
core.doc
core.encoding
core.encoding.base64
core.encoding.csv
core.encoding.hex
core.encoding.json
core.encoding.kdl
core.encoding.osad
core.encoding.utf8
core.hash
core.hash.md5
core.hash.sha1
core.hash.sha256
core.heap
core.intrinsics
core.intrinsics.atomics
core.intrinsics.onyx
core.intrinsics.types
core.intrinsics.wasm
core.io
core.io.binary
core.iter
core.js
core.list
core.map
core.math
core.memory
core.misc
core.net
core.os
core.random
core.set
core.slice
core.string
core.sync
core.test
core.thread
core.time
main
runtime
runtime.info
runtime.platform
runtime.vars
simd

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
MemDebugStackNode :: struct {
    file: [] u8;
    line: u32;
    current_line: u32;
    func_name: [] u8;
}
MemDebugState
MemDebugState :: struct {
    wrapped_allocator: Allocator;
    listen_addr: SocketAddress;
    socket: ? Socket;
    writer: ? Writer;
}
MemDebugMsg
MemDebugMsg :: union {
    Start: ;
    Action: ;
}
enable_in_scope
enable_in_scope :: macro (a: Allocator, port: i32) -> void
free
free :: (m: &MemDebugState) -> void
make
make :: (a: Allocator, listen_addr: &SocketAddress) -> MemDebugState
memdebug_proc
memdebug_proc :: (m: &MemDebugState, action: AllocationAction, size: u32, align: u32, oldptr: rawptr) -> rawptr
memdebug_send_message
memdebug_send_message :: (m: &MemDebugState, msg: MemDebugMsg) -> void
wait_for_connection
wait_for_connection :: (m: &MemDebugState) -> Result(void, Error)