diff --git a/quickjs.c b/quickjs.c index 6f4ce15..50c7648 100644 --- a/quickjs.c +++ b/quickjs.c @@ -1767,6 +1767,10 @@ void JS_SetDumpFlags(JSRuntime *rt, uint64_t flags) rt->dump_flags = flags; } +size_t JS_GetGCThreshold(JSRuntime *rt) { + return rt->malloc_gc_threshold; +} + /* use -1 to disable automatic GC */ void JS_SetGCThreshold(JSRuntime *rt, size_t gc_threshold) { diff --git a/quickjs.h b/quickjs.h index 0d7d5cb..5b1773e 100644 --- a/quickjs.h +++ b/quickjs.h @@ -305,6 +305,7 @@ JS_EXTERN void JS_SetRuntimeInfo(JSRuntime *rt, const char *info); /* use 0 to disable memory limit */ JS_EXTERN void JS_SetMemoryLimit(JSRuntime *rt, size_t limit); JS_EXTERN void JS_SetDumpFlags(JSRuntime *rt, uint64_t flags); +JS_EXTERN size_t JS_GetGCThreshold(JSRuntime *rt); JS_EXTERN void JS_SetGCThreshold(JSRuntime *rt, size_t gc_threshold); /* use 0 to disable maximum stack size check */ JS_EXTERN void JS_SetMaxStackSize(JSRuntime *rt, size_t stack_size);