summaryrefslogtreecommitdiff
path: root/rts/Threads.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2012-03-28 11:54:08 +0100
committerSimon Marlow <marlowsd@gmail.com>2012-03-28 14:45:14 +0100
commitfe0a45ef706f09a6ced55b457c38c9b96f01711f (patch)
treea8c9ca2af12d957550fbcea9b62330074ed255d8 /rts/Threads.c
parent734f1d484b12b785795b249b4116cfb4817ab55d (diff)
downloadhaskell-fe0a45ef706f09a6ced55b457c38c9b96f01711f.tar.gz
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.
Diffstat (limited to 'rts/Threads.c')
-rw-r--r--rts/Threads.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/rts/Threads.c b/rts/Threads.c
index fc520c6a93..802a37c94c 100644
--- a/rts/Threads.c
+++ b/rts/Threads.c
@@ -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
{