aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-12-17 12:17:42 +0000
committerMichael Williamson <mike@zwobble.org>2023-12-17 12:20:00 +0000
commit21d7c0efaf3cce4a518a0e6af946190d52113acc (patch)
treed77d07d31f767e501bb62889f60f03f3aaae71f5 /runtime
parent19c12f17b63119255fd7b0732b647158e4d27c68 (diff)
Add object as root before adding to list of objects
Diffstat (limited to 'runtime')
-rw-r--r--runtime/src/gc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/runtime/src/gc.c b/runtime/src/gc.c
index c7f50f11..c5738f63 100644
--- a/runtime/src/gc.c
+++ b/runtime/src/gc.c
@@ -111,14 +111,14 @@ void* shed__runtime__gc_alloc(size_t size, size_t children_offset, size_t childr
sizeof(void*) * children_count
);
- first = object;
-
// TODO: is it possible to leave adding the root to the caller, and avoid
// having to add so many roots? (Since some values will immediately become a
// descendant of a root.)
shed__runtime__gc_push_root_gc_object(object);
+ first = object;
+
return object;
}