aboutsummaryrefslogtreecommitdiffstats
path: root/clox/src/memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'clox/src/memory.c')
-rw-r--r--clox/src/memory.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/clox/src/memory.c b/clox/src/memory.c
index d1e0c5a..677feed 100644
--- a/clox/src/memory.c
+++ b/clox/src/memory.c
@@ -76,6 +76,11 @@ static void blackenObject(Obj *object) {
printf("\n");
#endif
switch (object->type) {
+ case OBJ_CLASS: {
+ ObjClass *klass = (ObjClass *)object;
+ markObject((Obj *)klass->name);
+ break;
+ }
case OBJ_CLOSURE: {
ObjClosure *closure = (ObjClosure *)object;
markObject((Obj *)closure->function);
@@ -105,6 +110,10 @@ static void freeObject(Obj *object) {
#endif // DEBUG_LOG_GC
switch (object->type) {
+ case OBJ_CLASS: {
+ FREE(ObjClass, object);
+ break;
+ }
case OBJ_CLOSURE: {
ObjClosure *closure = (ObjClosure *)object;
FREE_ARRAY(ObjUpvalue *, closure->upvalues, closure->upvalueCount);