Skip to content

Commit 8a04e04

Browse files
committed
feat: add support for turn off quickjs gc
1 parent 1f37670 commit 8a04e04

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

quickjs.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ struct JSRuntime {
205205
BOOL current_exception_is_uncatchable : 8;
206206
/* true if inside an out of memory error, to avoid recursing */
207207
BOOL in_out_of_memory : 8;
208+
BOOL gc_off: 8;
208209

209210
struct JSStackFrame *current_stack_frame;
210211

@@ -6100,6 +6101,8 @@ static void JS_RunGCInternal(JSRuntime *rt, BOOL remove_weak_objects)
61006101
registry callbacks. */
61016102
gc_remove_weak_objects(rt);
61026103
}
6104+
6105+
if (rt->gc_off) return;
61036106

61046107
/* decrement the reference of the children of each object. mark =
61056108
1 after this pass. */
@@ -55469,11 +55472,11 @@ int JS_FindWCharacterInAtom(JSRuntime* runtime, JSAtom atom, int (*CharacterMatc
5546955472
}
5547055473

5547155474
void JS_TurnOffGC(JSRuntime *rt) {
55472-
// rt->gc_off = TRUE;
55475+
rt->gc_off = TRUE;
5547355476
}
5547455477

5547555478
void JS_TurnOnGC(JSRuntime *rt) {
55476-
// rt->gc_off = FALSE;
55479+
rt->gc_off = FALSE;
5547755480
}
5547855481

5547955482
JSValue JS_GetPropertyWithThisObj(JSContext *ctx, JSValueConst obj, JSAtom prop, JSValueConst this_obj, BOOL throw_ref_error) {

0 commit comments

Comments
 (0)