From 8ec913756107cc8e6aee965d0dc080039d4995ad Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Thu, 9 Sep 2021 22:57:03 -0700 Subject: Chapter 19.5 --- clox/src/memory.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'clox/src/memory.h') diff --git a/clox/src/memory.h b/clox/src/memory.h index a810bd7..f7946f6 100644 --- a/clox/src/memory.h +++ b/clox/src/memory.h @@ -2,10 +2,13 @@ #define clox_memory_h #include "common.h" +#include "object.h" #define ALLOCATE(type, count) \ (type *)reallocate(NULL, 0, sizeof(type) * (count)) +#define FREE(type, pointer) reallocate(pointer, sizeof(type), 0) + #define GROW_CAPACITY(capacity) ((capacity) < 8 ? 8 : (capacity)*2) #define GROW_ARRAY(type, pointer, oldCount, newCount) \ @@ -16,5 +19,6 @@ reallocate(pointer, sizeof(type) * (oldCount), 0) void *reallocate(void *pointer, size_t oldSize, size_t newSize); +void freeObjects(); #endif -- cgit v1.2.3-54-g00ecf