diff options
Diffstat (limited to 'include/kpl/memory.h')
| -rw-r--r-- | include/kpl/memory.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/kpl/memory.h b/include/kpl/memory.h index b69867a..3bb4871 100644 --- a/include/kpl/memory.h +++ b/include/kpl/memory.h @@ -35,8 +35,10 @@ typedef struct { * The memory is allocated from buffer and returned to the pool * The slabs and buffers are freed and returned to the system at once on allocator free * The object pools are from each mapped buffer, they do not need to be freed + * The kpl_object_gc get their own allocator+pool because they do not align to a power of two and a lot are needed */ typedef struct { + kpl_memory_allocator_slab_group slab_gc; // all kpl_object_gc are allocated through here kpl_memory_allocator_slab_group slabs[KPL_MEMORY_ALLOCATOR_SLAB_COUNT]; } kpl_memory_allocator; @@ -57,6 +59,17 @@ void kpl_memory_allocator_free(kpl_memory_allocator *memory_allocator); void *kpl_memory_allocator_allocate(kpl_memory_allocator *memory_allocator, int32_t size, uint16_t thread_id); /* + * Only called though gc_new + * All allocations must extend KPL_OBJECT_GC_HEADER + */ +void *kpl_memory_allocator_allocate_gc(kpl_memory_allocator *memory_allocator, uint16_t thread_id); + +/* * Only call this though kpl_env_object_return */ void kpl_memory_allocator_return(kpl_memory_allocator *memory_allocator, void *object); + +/* + * Only called though gc delete + */ +void kpl_memory_allocator_return_gc(kpl_memory_allocator *memory_allocator, void *object); |
