summaryrefslogtreecommitdiff
path: root/rts/RtsUtils.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2017-04-01 19:52:40 -0400
committerBen Gamari <ben@smart-cactus.org>2017-04-02 12:01:47 -0400
commit61ba4518a48727f8cd7b821bd41631da82d37425 (patch)
tree421493e6de4af7744876c7a927b60e2a7b452112 /rts/RtsUtils.c
parentd89b0471888b15844b8bbf68159fe50830be8b24 (diff)
downloadhaskell-61ba4518a48727f8cd7b821bd41631da82d37425.tar.gz
Report heap overflow in the same way as stack overflow
Now that we throw an exception for heap overflow, we should only print the heap overflow message in the main thread when the HeapOverflow exception is caught, rather than as a side effect in the GC. Stack overflows were already done this way, I just made heap overflow consistent with stack overflow, and did some related cleanup. Fixes broken T2592(profasm) which was reporting the heap overflow message twice (you would only notice when building with profiling libs enabled). Test Plan: validate Reviewers: bgamari, niteria, austin, DemiMarie, hvr, erikd Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3394
Diffstat (limited to 'rts/RtsUtils.c')
-rw-r--r--rts/RtsUtils.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c
index 31dc060244..85f951addd 100644
--- a/rts/RtsUtils.c
+++ b/rts/RtsUtils.c
@@ -131,13 +131,11 @@ stgFree(void* p)
}
/* -----------------------------------------------------------------------------
- Stack overflow
-
- Not sure if this belongs here.
+ Stack/heap overflow
-------------------------------------------------------------------------- */
void
-stackOverflow(StgTSO* tso)
+reportStackOverflow(StgTSO* tso)
{
rtsConfig.stackOverflowHook(tso->tot_stack_size * sizeof(W_));
@@ -147,16 +145,11 @@ stackOverflow(StgTSO* tso)
}
void
-heapOverflow(void)
+reportHeapOverflow(void)
{
- if (!heap_overflow)
- {
- /* don't fflush(stdout); WORKAROUND bug in Linux glibc */
- rtsConfig.outOfHeapHook(0/*unknown request size*/,
- (W_)RtsFlags.GcFlags.maxHeapSize * BLOCK_SIZE);
-
- heap_overflow = true;
- }
+ /* don't fflush(stdout); WORKAROUND bug in Linux glibc */
+ rtsConfig.outOfHeapHook(0/*unknown request size*/,
+ (W_)RtsFlags.GcFlags.maxHeapSize * BLOCK_SIZE);
}
/* -----------------------------------------------------------------------------
@@ -351,4 +344,3 @@ void checkFPUStack(void)
}
#endif
}
-