summaryrefslogtreecommitdiff
path: root/rts/RtsFlags.c
diff options
context:
space:
mode:
Diffstat (limited to 'rts/RtsFlags.c')
-rw-r--r--rts/RtsFlags.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c
index 1368082730..c9da13bafc 100644
--- a/rts/RtsFlags.c
+++ b/rts/RtsFlags.c
@@ -129,7 +129,7 @@ void initRtsFlagsDefaults(void)
maxStkSize = 8 * 1024 * 1024;
RtsFlags.GcFlags.statsFile = NULL;
- RtsFlags.GcFlags.giveStats = NO_GC_STATS;
+ RtsFlags.GcFlags.giveStats = COLLECT_GC_STATS;
RtsFlags.GcFlags.maxStkSize = maxStkSize / sizeof(W_);
RtsFlags.GcFlags.initialStkSize = 1024 / sizeof(W_);
@@ -141,6 +141,7 @@ void initRtsFlagsDefaults(void)
RtsFlags.GcFlags.nurseryChunkSize = 0;
RtsFlags.GcFlags.minOldGenSize = (1024 * 1024) / BLOCK_SIZE;
RtsFlags.GcFlags.maxHeapSize = 0; /* off by default */
+ RtsFlags.GcFlags.heapLimitGrace = (1024 * 1024);
RtsFlags.GcFlags.heapSizeSuggestion = 0; /* none */
RtsFlags.GcFlags.heapSizeSuggestionAuto = false;
RtsFlags.GcFlags.pcFreeHeap = 3; /* 3% */
@@ -428,6 +429,11 @@ usage_text[] = {
" -xq The allocation limit given to a thread after it receives",
" an AllocationLimitExceeded exception. (default: 100k)",
"",
+" -Mgrace=<n>",
+" The amount of allocation after the program receives a",
+" HeapOverflow exception before the exception is thrown again, if",
+" the program is still exceeding the heap limit.",
+"",
"RTS options may also be specified using the GHCRTS environment variable.",
"",
"Other RTS options may be available for programs compiled a different way.",
@@ -905,11 +911,16 @@ error = true;
case 'M':
OPTION_UNSAFE;
- RtsFlags.GcFlags.maxHeapSize =
- decodeSize(rts_argv[arg], 2, BLOCK_SIZE, HS_WORD_MAX)
- / BLOCK_SIZE;
- /* user give size in *bytes* but "maxHeapSize" is in
- * *blocks* */
+ if (0 == strncmp("grace=", rts_argv[arg] + 2, 6)) {
+ RtsFlags.GcFlags.heapLimitGrace =
+ decodeSize(rts_argv[arg], 8, BLOCK_SIZE, HS_WORD_MAX);
+ } else {
+ RtsFlags.GcFlags.maxHeapSize =
+ decodeSize(rts_argv[arg], 2, BLOCK_SIZE, HS_WORD_MAX)
+ / BLOCK_SIZE;
+ // user give size in *bytes* but "maxHeapSize" is in
+ // *blocks*
+ }
break;
case 'm':