aboutsummaryrefslogtreecommitdiff
path: root/test/gc.c
diff options
context:
space:
mode:
authornodist <kevin.comas.git@gmail.com>2026-11-02 10:12:28 -0500
committernodist <kevin.comas.git@gmail.com>2026-11-02 10:12:28 -0500
commitfaa937cb09cd01f4ea94f5d7722a20e9c1246df0 (patch)
tree39126c9269c30a8ce7c0d3f2fea7d93f55fa42be /test/gc.c
parent25f0a58b850d85b990d811002038f0655d2676b5 (diff)
update gc every oject has pointer to gc object
Diffstat (limited to 'test/gc.c')
-rw-r--r--test/gc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/gc.c b/test/gc.c
index 023d942..2af29d3 100644
--- a/test/gc.c
+++ b/test/gc.c
@@ -10,11 +10,11 @@ KPL_TEST(basic_mark_and_sweep) {
env.threads = threads;
kpl_memory_allocator_init(&thread.memory_allocator);
kpl_gc_init(&thread.gc);
- kpl_object_gc *objs[TEST_OBJECT_COUNT] = {};
+ kpl_object *objs[TEST_OBJECT_COUNT] = {};
for (int32_t obj_index = 1; obj_index <= TEST_OBJECT_COUNT; obj_index++) {
objs[obj_index - 1] = kpl_gc_new(&thread, NULL, sizeof(kpl_object_error));
if (obj_index % 2 == 0)
- kpl_gc_mark(objs[obj_index - 1]);
+ kpl_gc_mark(objs[obj_index - 1]->object_gc_parent);
}
int32_t counter = 0;
kpl_object_gc *gc_head = thread.gc.gc_head;
@@ -32,6 +32,6 @@ KPL_TEST(basic_mark_and_sweep) {
gc_head = gc_head->gc_next;
}
KPL_ASSERT(counter == TEST_OBJECT_COUNT / 2, "should have removed half of the objects");
- kpl_gc_free(&thread.gc, &thread);
+ kpl_gc_free(&thread);
kpl_memory_allocator_free(&thread.memory_allocator);
}