[nhc-users] Setting the heap size at ct

Malcolm Wallace Malcolm.Wallace@cs.york.ac.uk
Thu, 1 Nov 2001 11:06:42 +0000


> > Sure, e.g. -H10m sets the heap size of an executable to 10 MB.

> Thanks. This does not work with hmake, however,
> 
> hmake -nhc98 -98 -H32M -ILib -PLib Main
> nhc98  +RTS -H32M -RTS -98  -ILib -PLib  -c -o Lib/Prettier.o Lib/Prettier.lhs
> 
> It encloses the -H32M option in RTS brackets. Is there a way around?

Ok, the story is a little bit complicated here.  hmake is itself a
Haskell program, so if you wanted to tell it to give the compiler
some extra heap, then   +RTS -H32M -RTS   would not work, because
that would actually tell *hmake* to use 32M, not the compiler.
Hence a plain -H32M as argument to hmake gives the behaviour you see,
which is the most common requirement.

However this leaves the problem of how to give the *final executable*
a larger heap.  Fortunately, the nhc98 compiler itself can accept either
of the following forms:

    nhc98 -H32M
    nhc98 +CTS -H32M -CTS

and so, from hmake, you must use the latter, e.g.

    hmake -nhc98 Main +CTS -H32M -CTS

[ The +CTS -CTS brackets are named for `Compile-Time System', by analogy
  with the more common +RTS -RTS for `Run-Time System'.  They can be used
  at any time to ensure that the enclosed arguments are definitely passed
  to the compiler proper.  This is also useful for instance with the -lib
  argument, which might otherwise be interpreted as a linker flag.
]

Regards,
    Malcolm