aboutsummaryrefslogtreecommitdiffstats
path: root/clox/src/object.c
diff options
context:
space:
mode:
authorGravatar Tom Willemse2022-06-04 22:00:27 -0700
committerGravatar Tom Willemse2022-06-04 22:00:27 -0700
commit14b3866ac09c80b8f34d79227d743eabb2da0f2a (patch)
tree62eb3137f016ceaec9d0c88e527a663372927d59 /clox/src/object.c
parent57ed9226c06b5fbe016e62857fe9662c51da3dfd (diff)
downloadcrafting-interpreters-14b3866ac09c80b8f34d79227d743eabb2da0f2a.tar.gz
crafting-interpreters-14b3866ac09c80b8f34d79227d743eabb2da0f2a.zip
Chapter 26.1, 26.2, 26.3, and 26.4
Diffstat (limited to 'clox/src/object.c')
-rw-r--r--clox/src/object.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/clox/src/object.c b/clox/src/object.c
index 31550ae..5f2bdde 100644
--- a/clox/src/object.c
+++ b/clox/src/object.c
@@ -13,9 +13,15 @@
static Obj *allocateObject(size_t size, ObjType type) {
Obj *object = (Obj *)reallocate(NULL, 0, size);
object->type = type;
+ object->isMarked = false;
object->next = vm.objects;
vm.objects = object;
+
+#ifdef DEBUG_LOG_GC
+ printf("%p allocate %zu for %d", (void *)object, size, type);
+#endif
+
return object;
}