Merge branch 'master' of http://darcs.haskell.org/ghc
[ghc.git] / ghc / hschooks.c
1 /*
2 These routines customise the error messages
3 for various bits of the RTS. They are linked
4 in instead of the defaults.
5 */
6
7 #include "../rts/PosixSource.h"
8 #include "Rts.h"
9
10 #include "HsFFI.h"
11
12 #include <string.h>
13
14 #ifdef HAVE_UNISTD_H
15 #include <unistd.h>
16 #endif
17
18 void
19 defaultsHook (void)
20 {
21 RtsFlags.GcFlags.heapSizeSuggestion = 6*1024*1024 / BLOCK_SIZE;
22 RtsFlags.GcFlags.maxStkSize = 512*1024*1024 / sizeof(W_);
23 RtsFlags.GcFlags.giveStats = COLLECT_GC_STATS;
24
25 // See #3408: the default idle GC time of 0.3s is too short on
26 // Windows where we receive console events once per second or so.
27 #if __GLASGOW_HASKELL__ >= 703
28 RtsFlags.GcFlags.idleGCDelayTime = SecondsToTime(5);
29 #else
30 RtsFlags.GcFlags.idleGCDelayTime = 5*1000;
31 #endif
32 }
33
34 void
35 StackOverflowHook (lnat stack_size) /* in bytes */
36 {
37 fprintf(stderr, "GHC stack-space overflow: current limit is %zu bytes.\nUse the `-K<size>' option to increase it.\n", (size_t)stack_size);
38 }
39