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 4093f9a318
commit 2674e97fb5
2 changed files with 5 additions and 0 deletions

View file

@ -1755,6 +1755,10 @@ void JS_SetDumpFlags(JSRuntime *rt, uint64_t flags)
rt->dump_flags = flags; rt->dump_flags = flags;
} }
size_t JS_GetGCThreshold(JSRuntime *rt) {
return rt->malloc_gc_threshold;
}
/* use 0 to disable automatic GC */ /* use 0 to disable automatic GC */
void JS_SetGCThreshold(JSRuntime *rt, size_t gc_threshold) void JS_SetGCThreshold(JSRuntime *rt, size_t gc_threshold)
{ {

View file

@ -301,6 +301,7 @@ JS_EXTERN void JS_SetRuntimeInfo(JSRuntime *rt, const char *info);
/* use 0 to disable memory limit */ /* use 0 to disable memory limit */
JS_EXTERN void JS_SetMemoryLimit(JSRuntime *rt, size_t limit); JS_EXTERN void JS_SetMemoryLimit(JSRuntime *rt, size_t limit);
JS_EXTERN void JS_SetDumpFlags(JSRuntime *rt, uint64_t flags); JS_EXTERN void JS_SetDumpFlags(JSRuntime *rt, uint64_t flags);
JS_EXTERN size_t JS_GetGCThreshold(JSRuntime *rt);
/* use 0 to disable automatic GC */ /* use 0 to disable automatic GC */
JS_EXTERN void JS_SetGCThreshold(JSRuntime *rt, size_t gc_threshold); JS_EXTERN void JS_SetGCThreshold(JSRuntime *rt, size_t gc_threshold);
/* use 0 to disable maximum stack size check */ /* use 0 to disable maximum stack size check */