diff options
author | Simon Marlow <marlowsd@gmail.com> | 2015-09-14 13:37:38 +0100 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2015-09-14 15:09:54 +0100 |
commit | 12b0bb6f15caa5b4b01d0330a7a8d23e3c10842c (patch) | |
tree | 82b958b1de674910cbd99ec46241865d6f9fa711 /rts/Threads.c | |
parent | c8d438fb027cbefa31941d8397539c481a03a74f (diff) | |
download | haskell-12b0bb6f15caa5b4b01d0330a7a8d23e3c10842c.tar.gz |
Account for stack allocation in the thread's allocation counter
Summary: (see comment for details)
Test Plan: validate
Reviewers: bgamari, ezyang, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1243
Diffstat (limited to 'rts/Threads.c')
-rw-r--r-- | rts/Threads.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/rts/Threads.c b/rts/Threads.c index 434e1298c2..203a248794 100644 --- a/rts/Threads.c +++ b/rts/Threads.c @@ -602,7 +602,15 @@ threadStackOverflow (Capability *cap, StgTSO *tso) "allocating new stack chunk of size %d bytes", chunk_size * sizeof(W_)); + // Charge the current thread for allocating stack. Stack usage is + // non-deterministic, because the chunk boundaries might vary from + // run to run, but accounting for this is better than not + // accounting for it, since a deep recursion will otherwise not be + // subject to allocation limits. + cap->r.rCurrentTSO = tso; new_stack = (StgStack*) allocate(cap, chunk_size); + cap->r.rCurrentTSO = NULL; + SET_HDR(new_stack, &stg_STACK_info, old_stack->header.prof.ccs); TICK_ALLOC_STACK(chunk_size); |