22 lines
748 B
C++
22 lines
748 B
C++
#include "Allocator.h"
|
|
#include "Base_Thread_Context.h"
|
|
|
|
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);
|
|
}
|
|
|