[Haskell-cafe] is 256M RAM insufficient for a 20 million element Int/Int map?

Bulat Ziganshin bulat.ziganshin at gmail.com
Sun Oct 19 08:12:04 EDT 2008

Hello Philippa,

Sunday, October 19, 2008, 3:58:35 PM, you wrote:

>> what you mean? max heap size is 2gb probably. it may be configured on

> Ah, so you can't trust GHC to pick a max heap size within what the OS 
> actually has available?

hm, this includes virtual memory too. there are code snippets that
limits heap to, say, 80% of RAM:

/* after a tip from David Roundy */
#include <Rts.h>
#include <RtsFlags.h>
#include <unistd.h>

void defaultsHook (void) {
  RtsFlags.GcFlags.maxStkSize  =  8*10000002 / sizeof(W_); /* 80M */

  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;

but my point was about original program thta doesn't include any such
tricks, of course

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com

More information about the Haskell-Cafe mailing list