Packages

builtin
cbindgen
core
core.alloc
core.alloc.arena
core.alloc.atomic
core.alloc.debug
core.alloc.fixed
core.alloc.gc
core.alloc.heap
core.alloc.log
core.alloc.memwatch
core.alloc.pool
core.alloc.ring
core.arg_parse
core.array
core.avl_tree
core.bucket_array
core.conv
core.crypto
core.crypto.keys
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.encoding.xml
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.memwatch

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 MEMWATCH in runtime.vars, or pass -DMEMWATCH on the command line.

MemWatchStackNode
MemWatchStackNode :: struct {
    file: [] u8
    line: u32
    current_line: u32
    func_name: [] u8
}
MemWatchState
MemWatchState :: struct {
    wrapped_allocator: Allocator
    listen_addr: SocketAddress
    socket: ? Socket
    writer: ? Writer
}
MemWatchMsg
MemWatchMsg :: union {
    Start: 
    Action: 
}
enable_in_scope
enable_in_scope :: macro (a: Allocator, port: i32) -> void
free
free :: (m: &MemWatchState) -> void
make
make :: (a: Allocator, listen_addr: &SocketAddress) -> MemWatchState
wait_for_connection
wait_for_connection :: (m: &MemWatchState) -> Result(void, Error)