Allocator.h 435 B

12345678910111213141516171819202122232425262728
  1. #ifndef ALLOCATOR_H
  2. #define ALLOCATOR_H
  3. #include <stdbool.h>
  4. typedef struct {
  5. int length;
  6. int next;
  7. bool marked;
  8. // Object* data;
  9. } Array;
  10. typedef struct {
  11. int capacity;
  12. int usedStart;
  13. int freeStart;
  14. Array* data;
  15. } Allocator;
  16. void aInit(Allocator* a);
  17. void aDelete(Allocator* a);
  18. int aAllocate(Allocator* a, int length);
  19. void aClearMarker(Allocator* a);
  20. void aRemoveUnmarked(Allocator* a);
  21. #endif