32 #ifndef __TOMMYALLOC_H
33 #define __TOMMYALLOC_H
43 struct tommy_allocator_entry_struct {
44 struct tommy_allocator_entry_struct* next;
46 typedef struct tommy_allocator_entry_struct tommy_allocator_entry;
Allocator of fixed size blocks.
Definition: tommyalloc.h:51
tommy_uint32_t tommy_count_t
Generic unsigned integer for counting objects.
Definition: tommytypes.h:67
struct tommy_allocator_entry_struct * free_block
List of free blocks.
Definition: tommyalloc.h:52
void tommy_allocator_free(tommy_allocator *alloc, void *ptr)
Deallocates a block.
tommy_size_t align_size
Alignment size.
Definition: tommyalloc.h:55
void tommy_allocator_init(tommy_allocator *alloc, tommy_size_t block_size, tommy_size_t align_size)
Initializes the allocator.
tommy_size_t block_size
Block size.
Definition: tommyalloc.h:54
struct tommy_allocator_entry_struct * used_segment
List of allocated segments.
Definition: tommyalloc.h:53
void * tommy_allocator_alloc(tommy_allocator *alloc)
Allocates a block.
struct tommy_allocator_struct tommy_allocator
Allocator of fixed size blocks.
size_t tommy_size_t
Generic size_t type.
Definition: tommytypes.h:50
tommy_size_t tommy_allocator_memory_usage(tommy_allocator *alloc)
Gets the size of allocated memory.
void tommy_allocator_done(tommy_allocator *alloc)
Deinitialize the allocator.
tommy_count_t count
Number of allocated elements.
Definition: tommyalloc.h:56