aboutsummaryrefslogtreecommitdiffstats
path: root/clox/src/memory.h
diff options
context:
space:
mode:
authorGravatar Tom Willemse2021-09-09 22:57:03 -0700
committerGravatar Tom Willemse2021-09-09 22:57:03 -0700
commit8ec913756107cc8e6aee965d0dc080039d4995ad (patch)
tree818fa7ca8314eaed7745d6fe4a7cc9f0c1b4ca6d /clox/src/memory.h
parentd5f352e577acf1f472150df5578ff6d693258ae3 (diff)
downloadcrafting-interpreters-8ec913756107cc8e6aee965d0dc080039d4995ad.tar.gz
crafting-interpreters-8ec913756107cc8e6aee965d0dc080039d4995ad.zip
Chapter 19.5
Diffstat (limited to 'clox/src/memory.h')
-rw-r--r--clox/src/memory.h4
1 files changed, 4 insertions, 0 deletions
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