Skip to content

Commit ed8f734

Browse files
KaruroChorisaghul
authored andcommitted
Add getter for GC threshold
1 parent d3da56b commit ed8f734

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

quickjs.c

+4
Original file line numberDiff line numberDiff line change
@@ -1767,6 +1767,10 @@ void JS_SetDumpFlags(JSRuntime *rt, uint64_t flags)
17671767
rt->dump_flags = flags;
17681768
}
17691769

1770+
size_t JS_GetGCThreshold(JSRuntime *rt) {
1771+
return rt->malloc_gc_threshold;
1772+
}
1773+
17701774
/* use -1 to disable automatic GC */
17711775
void JS_SetGCThreshold(JSRuntime *rt, size_t gc_threshold)
17721776
{

quickjs.h

+1
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ JS_EXTERN void JS_SetRuntimeInfo(JSRuntime *rt, const char *info);
305305
/* use 0 to disable memory limit */
306306
JS_EXTERN void JS_SetMemoryLimit(JSRuntime *rt, size_t limit);
307307
JS_EXTERN void JS_SetDumpFlags(JSRuntime *rt, uint64_t flags);
308+
JS_EXTERN size_t JS_GetGCThreshold(JSRuntime *rt);
308309
JS_EXTERN void JS_SetGCThreshold(JSRuntime *rt, size_t gc_threshold);
309310
/* use 0 to disable maximum stack size check */
310311
JS_EXTERN void JS_SetMaxStackSize(JSRuntime *rt, size_t stack_size);

0 commit comments

Comments
 (0)