From: Gabriel Ivăncescu <gabrielopcode(a)gmail.com> Better heuristics can be used in the future. Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)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 875130f7e66..d37f048343b 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -938,6 +938,7 @@ HRESULT gc_run(script_ctx_t *ctx) jsdisp_release(obj); } + ctx->gc_last_tick = GetTickCount(); return S_OK; } @@ -2138,6 +2139,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 928a7f1ee7e..266928b9b1c 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -380,6 +380,7 @@ struct _script_ctx_t { jsval_t *stack; unsigned stack_top; + DWORD gc_last_tick; jsval_t acc; jsstr_t *last_match; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/1635