Skip to content

Commit f843fda

Browse files
Add implementation note
1 parent 34b8a14 commit f843fda

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ext/witapi/witapi-core.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,11 @@ bool rb_abi_guest_rb_gc_enable(void) { return rb_gc_enable() == Qtrue; }
331331

332332
VALUE rb_gc_disable_no_rest(void);
333333
bool rb_abi_guest_rb_gc_disable(void) {
334+
// NOTE: rb_gc_disable() is usually preferred to free up memory as much as
335+
// possible before disabling GC. However it may trigger GC through gc_rest(),
336+
// and triggering GC having a sandwitched JS frame is unsafe because it misses
337+
// to mark some living objects in the frames behind the JS frame. So we use
338+
// rb_gc_disable_no_rest(), which does not trigger GC, instead.
334339
return rb_gc_disable_no_rest() == Qtrue;
335340
}
336341

0 commit comments

Comments
 (0)