Add getter for GC threshold

This commit is contained in:
KaruroChori 2024-06-04 17:40:07 +02:00 committed by Saúl Ibarra Corretgé
parent d3da56b630
commit ed8f73413c
2 changed files with 5 additions and 0 deletions

View file

@ -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)
{

View file

@ -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);