GhosttyAllocator class final

Custom memory allocator.

For functions that take an allocator pointer, a NULL pointer indicates that the default allocator should be used. The default allocator will be libc malloc/free if we're linking to libc. If libc isn't linked, a custom allocator is used (currently Zig's SMP allocator).

@ingroup allocator

Usage example: @code GhosttyAllocator allocator = { .vtable = &my_allocator_vtable, .ctx = my_allocator_state }; @endcode

Inheritance
Implemented types
Available extensions

Constructors

GhosttyAllocator()

Properties

address Pointer<T>

Available on T, provided by the StructAddress extension

The memory address of the underlying data.
no setter
ctx Pointer<Void>
Opaque context pointer passed to all vtable functions. This allows the allocator implementation to maintain state or reference external resources needed for memory management.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
vtable Pointer<GhosttyAllocatorVtable>
Pointer to the allocator's vtable containing function pointers for memory operations (alloc, resize, remap, free).
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited