GhciMonad.resume should restore the program's argv and progname
[ghc-hetmet.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.h"
8 #if __GLASGOW_HASKELL__ <611
9 #include "RtsFlags.h"
10 #endif
11
12 #include "HsFFI.h"
13
14 #include <string.h>
15
16 #ifdef HAVE_UNISTD_H
17 #include <unistd.h>
18 #endif
19
20 void
21 defaultsHook (void)
22 {
23     RtsFlags.GcFlags.heapSizeSuggestion = 6*1024*1024 / BLOCK_SIZE;
24     RtsFlags.GcFlags.maxStkSize         = 512*1024*1024 / sizeof(W_);
25     RtsFlags.GcFlags.giveStats = COLLECT_GC_STATS;
26     RtsFlags.GcFlags.statsFile = stderr;
27
28     // See #3408: the default idle GC time of 0.3s is too short on
29     // Windows where we receive console events once per second or so.
30     RtsFlags.GcFlags.idleGCDelayTime = 5*1000;
31 }
32
33 void
34 StackOverflowHook (unsigned long stack_size)    /* in bytes */
35 {
36     fprintf(stderr, "GHC stack-space overflow: current limit is %ld bytes.\nUse the `-K<size>' option to increase it.\n", stack_size);
37 }
38