Commit fe0a45ef authored by Simon Marlow's avatar Simon Marlow

threadStackOverflow: Tweak to stack chunk sizing

If the old stack is only half full, then the next chunk we allocate
will be twice as large, to accommodate large requests for stack.  In
that case, make sure that the chunk we allocate is at least as large
as the usual chunk size - there's no point allocating a 2k chunk
(double the default initial chunk size of 1k) if in the normal case we
would allocate a 32k chunk.
parent 734f1d48
......@@ -558,7 +558,8 @@ threadStackOverflow (Capability *cap, StgTSO *tso)
//
if (old_stack->sp > old_stack->stack + old_stack->stack_size / 2)
{
chunk_size = 2 * (old_stack->stack_size + sizeofW(StgStack));
chunk_size = stg_max(2 * (old_stack->stack_size + sizeofW(StgStack)),
RtsFlags.GcFlags.stkChunkSize);
}
else
{
......
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