aboutsummaryrefslogtreecommitdiff
path: root/runtime/src
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-12-17 12:17:07 +0000
committerMichael Williamson <mike@zwobble.org>2023-12-17 12:20:00 +0000
commit19c12f17b63119255fd7b0732b647158e4d27c68 (patch)
tree563982ebce87f161e1a3f3f3321cc036d13d4077 /runtime/src
parentc7186f807385b16a08f3cb7f8bea75a6c3b4fb9f (diff)
Zero out GC children on alloc
Diffstat (limited to 'runtime/src')
-rw-r--r--runtime/src/gc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/runtime/src/gc.c b/runtime/src/gc.c
index 4464c3f0..c7f50f11 100644
--- a/runtime/src/gc.c
+++ b/runtime/src/gc.c
@@ -105,6 +105,12 @@ void* shed__runtime__gc_alloc(size_t size, size_t children_offset, size_t childr
object->children_offset = children_offset;
object->children_count = children_count;
+ __builtin_memset(
+ ((void*) object) + children_offset,
+ 0,
+ sizeof(void*) * children_count
+ );
+
first = object;
// TODO: is it possible to leave adding the root to the caller, and avoid