On Thu, Jan 29, 2004 at 01:13:28PM +0100, Ketil Malde wrote:
My aplogies for being unclear! What I really want is the amount of memory my application can allocate and excercise lively without causing thrashing. On my Linux computer, that amounts more or less to the installed, physical RAM, minus a bit, so I'll settle for that. :-)
(After browsing various information, it seems I'm after the minimum of physical RAM and getrlimit(RLIMIT_DATA)).
I use the following with ghc. You don't really want to do this in haskell, since there's no way to set the RTS values from haskell anyways. #include <Rts.h> #include <RtsFlags.h> #include <unistd.h> void defaultsHook (void) { RtsFlags.GcFlags.maxStkSize = 8*1000002 / sizeof(W_); /* 8M */ #ifdef _SC_PHYS_PAGES unsigned long long pagesize = sysconf(_SC_PAGESIZE); unsigned long long numpages = sysconf(_SC_PHYS_PAGES); unsigned long long mhs = 2*numpages*pagesize; RtsFlags.GcFlags.maxHeapSize = 1ULL+mhs/BLOCK_SIZE_W; #endif } -- David Roundy http://civet.berkeley.edu/droundy/