Module: wine Branch: master Commit: d192aa102f69ff80d1d449431d695216ca52b7df URL: https://gitlab.winehq.org/wine/wine/-/commit/d192aa102f69ff80d1d449431d69521...
Author: Gabriel Ivăncescu gabrielopcode@gmail.com Date: Thu Dec 8 17:02:51 2022 +0200
jscript: Run the garbage collector every 30 seconds on a new object allocation.
Better heuristics can be used in the future.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com
---
dlls/jscript/dispex.c | 5 +++++ dlls/jscript/jscript.h | 1 + 2 files changed, 6 insertions(+)
diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index bc6c18bd7ec..04632f4c755 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -945,6 +945,7 @@ HRESULT gc_run(script_ctx_t *ctx) }
ctx->gc_is_unlinking = FALSE; + ctx->gc_last_tick = GetTickCount(); return S_OK; }
@@ -2145,6 +2146,10 @@ HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *b { unsigned i;
+ /* FIXME: Use better heuristics to decide when to run the GC */ + if(GetTickCount() - ctx->gc_last_tick > 30000) + gc_run(ctx); + TRACE("%p (%p)\n", dispex, prototype);
dispex->IDispatchEx_iface.lpVtbl = &DispatchExVtbl; diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 66a4258306b..b633f390508 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -379,6 +379,7 @@ struct _script_ctx_t { heap_pool_t tmp_heap;
BOOL gc_is_unlinking; + DWORD gc_last_tick;
jsval_t *stack; unsigned stack_top;