From 2674e97fb571b7c37fcde50d4a1ea1054584e02c 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 221ef6d..946caf5 100644 --- a/quickjs.c +++ b/quickjs.c @@ -1755,6 +1755,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 0 to disable automatic GC */ void JS_SetGCThreshold(JSRuntime *rt, size_t gc_threshold) { diff --git a/quickjs.h b/quickjs.h index c9843d2..e3ac650 100644 --- a/quickjs.h +++ b/quickjs.h @@ -301,6 +301,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); /* use 0 to disable automatic GC */ JS_EXTERN void JS_SetGCThreshold(JSRuntime *rt, size_t gc_threshold); /* use 0 to disable maximum stack size check */