2024-08-24 17:33:57 -04:00
|
|
|
#ifndef GC_ALLOC_H
|
|
|
|
#define GC_ALLOC_H
|
2024-08-22 21:38:25 -04:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2024-09-16 17:25:07 -04:00
|
|
|
// Metadata for allocated memory
|
|
|
|
struct gc_block_header {
|
2024-09-06 11:05:16 -04:00
|
|
|
size_t size;
|
|
|
|
int free;
|
2024-09-16 17:25:07 -04:00
|
|
|
struct gc_block_header *next;
|
2024-08-22 21:38:25 -04:00
|
|
|
};
|
|
|
|
|
2024-09-16 17:25:07 -04:00
|
|
|
// Performs allocations of SIZE bytes
|
|
|
|
void *gc_malloc(size_t size);
|
2024-08-22 21:38:25 -04:00
|
|
|
|
2024-09-16 17:25:07 -04:00
|
|
|
// Frees blocks of memory allocated by 'gc_alloc'
|
|
|
|
void gc_free(void *ptr);
|
2024-08-22 21:38:25 -04:00
|
|
|
|
2024-08-24 17:33:57 -04:00
|
|
|
#endif /* GC_ALLOC_H */
|