[commit: ghc] master: rts: Set default maximum stack size to 80% of physical memory (edbf51a)
git at git.haskell.org
git at git.haskell.org
Fri Oct 25 14:22:29 UTC 2013
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/edbf51ab0ca99ceb6c42bc61b71f876e31fc6b30/ghc
>---------------------------------------------------------------
commit edbf51ab0ca99ceb6c42bc61b71f876e31fc6b30
Author: Ben Gamari <bgamari.foss at gmail.com>
Date: Thu Sep 12 23:20:06 2013 -0400
rts: Set default maximum stack size to 80% of physical memory
>---------------------------------------------------------------
edbf51ab0ca99ceb6c42bc61b71f876e31fc6b30
rts/RtsFlags.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c
index bf924c2..12bb44c 100644
--- a/rts/RtsFlags.c
+++ b/rts/RtsFlags.c
@@ -13,6 +13,7 @@
#include "RtsUtils.h"
#include "Profiling.h"
#include "RtsFlags.h"
+#include "sm/OSMem.h"
#ifdef HAVE_CTYPE_H
#include <ctype.h>
@@ -93,10 +94,15 @@ static void errorRtsOptsDisabled(HsBool is_hs_main, const char *s);
void initRtsFlagsDefaults(void)
{
+ StgWord64 maxStkSize = 8 * getPhysicalMemorySize() / 10;
+ // if getPhysicalMemorySize fails just move along with an 8MB limit
+ if (maxStkSize == 0)
+ maxStkSize = (8 * 1024 * 1024) / sizeof(W_);
+
RtsFlags.GcFlags.statsFile = NULL;
RtsFlags.GcFlags.giveStats = NO_GC_STATS;
- RtsFlags.GcFlags.maxStkSize = (8 * 1024 * 1024) / sizeof(W_);
+ RtsFlags.GcFlags.maxStkSize = maxStkSize;
RtsFlags.GcFlags.initialStkSize = 1024 / sizeof(W_);
RtsFlags.GcFlags.stkChunkSize = (32 * 1024) / sizeof(W_);
RtsFlags.GcFlags.stkChunkBufferSize = (1 * 1024) / sizeof(W_);
More information about the ghc-commits
mailing list