libghostty
Loading...
Searching...
No Matches
GhosttyAllocator Struct Reference

#include <ghostty/vt/allocator.h>

Data Fields

void * ctx
const GhosttyAllocatorVtablevtable

Detailed Description

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).

Usage example:

GhosttyAllocator allocator = {
.vtable = &my_allocator_vtable,
.ctx = my_allocator_state
};

Definition at line 179 of file allocator.h.

Field Documentation

◆ ctx

void* ctx

Opaque context pointer passed to all vtable functions. This allows the allocator implementation to maintain state or reference external resources needed for memory management.

Definition at line 185 of file allocator.h.

◆ vtable

const GhosttyAllocatorVtable* vtable

Pointer to the allocator's vtable containing function pointers for memory operations (alloc, resize, remap, free).

Definition at line 191 of file allocator.h.


The documentation for this struct was generated from the following file: