defaultsHook isn't documented

Bulat Ziganshin bulat.ziganshin at
Mon May 18 07:18:24 EDT 2009

Hello Simon,

Monday, May 18, 2009, 3:11:20 PM, you wrote:

>> it seems that defaultsHook isn't documented on

> I think we'd like people to use ghc_rts_opts instead, if possible.  Do
> you have a good reason to need defaultsHook instead?  One problem with
> it is that defaultsHook ends up depending on the representation of the
> RtsFlags structure, which we change from time to time.

afaik, ghc_rts_opts can't built dynamically that means it cannot solve
some problems. as example, the following hook allows haskell program
to use up to 80% of RAM:

void defaultsHook (void) {
  unsigned long long pagesize = sysconf(_SC_PAGESIZE);
  unsigned long long numpages = sysconf(_SC_PHYS_PAGES);
  unsigned long long mhs = numpages*pagesize*8/10;
  RtsFlags.GcFlags.maxHeapSize = 1ULL+mhs/BLOCK_SIZE_W;

a good idea may be addition of hook that returns *string* with RTS

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at

More information about the Glasgow-haskell-users mailing list