From ed8f73413c1480dbacf90662c02da51a1e1887a2 Mon Sep 17 00:00:00 2001 From: KaruroChori Date: Tue, 4 Jun 2024 17:40:07 +0200 Subject: [PATCH] Add getter for GC threshold --- quickjs.c | 4 ++++ quickjs.h | 1 + 2 files changed, 5 insertions(+) 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);