max heap exhausted

Hal Daume III hdaume@ISI.EDU
Mon, 15 Apr 2002 08:04:41 -0700 (PDT)


What does it mean when my program tells me:

  "fatal error: RTS exhausted max heap size (268435456 bytes)"

?

My initial understanding was the GHC allocated (perhaps dynamically) a
heap of unlimited size (at least so says +RTS -help) and when I run my
(long memory grabbing) program without any RTS flags it gets about 1/4 of
the way done (on my Windows box -- this is ghc5.03 the original
snapshot) and then tells me this.

So I go to increase the heap (i have 1g of ram) so I say "+RTS -H512m" and
immediately it comes back to me with the same error (presumably in trying
to allocate the heap?).

I think there are really two error messages going on here: the first is
truly that the heap is exhausted, but the second is more of "I can't
allocate that much".  Am I correct?  If so, why not?  I can run it with
-H300m, but not -H350m (on the first RTS doesn't complain until later; on
the second it complains immediately).  How can I give my program more heap
and why does -H300m give it more heap than without any RTS options which
should give it unlimited heap?

 - Hal

--
Hal Daume III

 "Computer science is no more about computers    | hdaume@isi.edu
  than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume