Musa-Cpp-Lib-V2/lib/Base/Allocator.cpp
2025-11-23 04:09:52 -05:00

19 lines
691 B
C++

void* internal_alloc (s64 size) {
Allocator allocator = get_context_allocator();
void* result = allocator.proc(Allocator_Mode::ALLOCATE, size, 0, nullptr, allocator.data);
return result;
}
// #NOTE: internal_realloc does NOT copy anything! It just hands you new memory to work with!
void* internal_realloc (void* memory, s64 size, s64 old_size) {
Allocator allocator = get_context_allocator();
void* result = allocator.proc(Allocator_Mode::RESIZE, size, old_size, memory, allocator.data);
return result;
}
void internal_free (void* memory) {
Allocator allocator = get_context_allocator();
allocator.proc(Allocator_Mode::DEALLOCATE, 0, 0, memory, allocator.data);
}