Commit d192aa10 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

jscript: Run the garbage collector every 30 seconds on a new object allocation.

Better heuristics can be used in the future. Signed-off-by: 's avatarGabriel Ivăncescu <gabrielopcode@gmail.com>
parent 809a91b8
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment