Klemens Hemm wrote:
> is there a way to permanently change the default heap and stack sizes
> for a compiled program, without doing all the time the +RTS -K.. -H.. > thing on the 
>command line ?

There is a C-hook which is called after the defaults have been set, but
before they are actually used. Example (for -K1M -H20M):

#include "rtsdefs.h"
void defaultsHook (void) {
   RTSflags.GcFlags.stksSize =  1000002 / sizeof(W_);
   RTSflags.GcFlags.heapSize = 20000002 / sizeof(W_);
}

Using powers of two causes bad cache behaviour on direct-mapped caches,
so be careful.  Compile the function above with your favourite C-compiler
and link it with your application.

For the curious people: Have a look at fptools/ghc/runtime/main/RtsFlags.lc
("Use the source, Luke!" :-)

[ AFAK, this is not in the info files. Probably this should be added. ]

-- 
Sven Panne                                        Tel.: +49/89/2178-2235
LMU, Institut fuer Informatik                     FAX : +49/89/2178-2211
LFE Programmier- und Modellierungssprachen              Oettingenstr. 67
mailto:[EMAIL PROTECTED]            D-80538 Muenchen
http://www.pms.informatik.uni-muenchen.de/mitarbeiter/panne

Reply via email to