25 lines
945 B
C++
25 lines
945 B
C++
void* internal_alloc (s64 size) {
|
|
Allocator allocator = 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 = context_allocator();
|
|
void* result = allocator.proc(Allocator_Mode::RESIZE, size, old_size, memory, allocator.data);
|
|
return result;
|
|
}
|
|
|
|
void internal_free (void* memory) {
|
|
Allocator allocator = context_allocator();
|
|
allocator.proc(Allocator_Mode::DEALLOCATE, 0, 0, memory, allocator.data);
|
|
}
|
|
|
|
void print_context_allocator () {
|
|
Assert(thread_context()->allocator.proc);
|
|
|
|
char* result = (char*)thread_context()->allocator.proc(Allocator_Mode::DETAILS, 0, 0, nullptr, thread_context()->allocator.data);
|
|
log_none("Current allocator details: %s", result);
|
|
}
|