Compare commits
2 commits
master
...
gc-thresho
Author | SHA1 | Date | |
---|---|---|---|
|
2674e97fb5 | ||
|
4093f9a318 |
2 changed files with 8 additions and 2 deletions
|
@ -1341,7 +1341,7 @@ static void js_trigger_gc(JSRuntime *rt, size_t size)
|
||||||
force_gc = TRUE;
|
force_gc = TRUE;
|
||||||
#else
|
#else
|
||||||
force_gc = ((rt->malloc_state.malloc_size + size) >
|
force_gc = ((rt->malloc_state.malloc_size + size) >
|
||||||
rt->malloc_gc_threshold);
|
rt->malloc_gc_threshold - 1);
|
||||||
#endif
|
#endif
|
||||||
if (force_gc) {
|
if (force_gc) {
|
||||||
#ifdef DUMP_GC
|
#ifdef DUMP_GC
|
||||||
|
@ -1755,7 +1755,11 @@ void JS_SetDumpFlags(JSRuntime *rt, uint64_t flags)
|
||||||
rt->dump_flags = flags;
|
rt->dump_flags = flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* use -1 to disable automatic GC */
|
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)
|
void JS_SetGCThreshold(JSRuntime *rt, size_t gc_threshold)
|
||||||
{
|
{
|
||||||
rt->malloc_gc_threshold = gc_threshold;
|
rt->malloc_gc_threshold = gc_threshold;
|
||||||
|
|
|
@ -301,6 +301,8 @@ 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 */
|
||||||
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 */
|
||||||
JS_EXTERN void JS_SetMaxStackSize(JSRuntime *rt, size_t stack_size);
|
JS_EXTERN void JS_SetMaxStackSize(JSRuntime *rt, size_t stack_size);
|
||||||
|
|
Loading…
Reference in a new issue