summaryrefslogtreecommitdiff
path: root/rts/RtsUtils.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2008-12-09 10:59:19 +0000
committerSimon Marlow <marlowsd@gmail.com>2008-12-09 10:59:19 +0000
commit5a5acb3698aa4ffdd738c301fa722afe12a1f3de (patch)
treece83c8c73753a70b85b2409745b7498e00555559 /rts/RtsUtils.c
parent31d797eb1b3c5aa07f928b58402529fd35b71bcc (diff)
downloadhaskell-5a5acb3698aa4ffdd738c301fa722afe12a1f3de.tar.gz
Fix #2592: do an orderly shutdown when the heap is exhausted
Really we should be raising an exception in this case, but that's tricky (see comments). At least now we shut down the runtime correctly rather than just exiting.
Diffstat (limited to 'rts/RtsUtils.c')
-rw-r--r--rts/RtsUtils.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c
index 0123531e27..7d6c4a557c 100644
--- a/rts/RtsUtils.c
+++ b/rts/RtsUtils.c
@@ -13,6 +13,7 @@
#include "RtsFlags.h"
#include "RtsUtils.h"
#include "Ticky.h"
+#include "Schedule.h"
#ifdef HAVE_TIME_H
#include <time.h>
@@ -272,15 +273,14 @@ stackOverflow(void)
void
heapOverflow(void)
{
- /* don't fflush(stdout); WORKAROUND bug in Linux glibc */
- OutOfHeapHook(0/*unknown request size*/,
- RtsFlags.GcFlags.maxHeapSize * BLOCK_SIZE);
-
-#if defined(TICKY_TICKY)
- if (RtsFlags.TickyFlags.showTickyStats) PrintTickyInfo();
-#endif
+ if (!heap_overflow)
+ {
+ /* don't fflush(stdout); WORKAROUND bug in Linux glibc */
+ OutOfHeapHook(0/*unknown request size*/,
+ RtsFlags.GcFlags.maxHeapSize * BLOCK_SIZE);
- stg_exit(EXIT_HEAPOVERFLOW);
+ heap_overflow = rtsTrue;
+ }
}
/* -----------------------------------------------------------------------------