[Haskell-cafe] Memory-aware Haskell?

Daniel Fischer daniel.is.fischer at web.de
Fri Dec 25 10:21:49 EST 2009


Am Freitag 25 Dezember 2009 15:45:29 schrieb Gwern Branwen:
> On Fri, Dec 25, 2009 at 5:14 AM, Svein Ove Aas <svein.ove at aas.no> wrote:
> > On Thu, Dec 24, 2009 at 11:38 PM, Roman Cheplyaka <roma at ro-che.info> wrote:
> >> So, let's think what we can do at runtime. Suppose RTS takes the
> >> parameter -- upper limit of consumed memory. When it sees that memory
> >> consumption is close to upper bound, it can:
> >>
> >> 1. force garbage collection
> >
> > This is already implemented. See the -M RTS option.
>
> Correct me if I'm wrong - it's been a while since I tried to use the
> -M option to deal with Gitit memory usage on darcs.net - but doesn't
> -M just kill the program after it reaches a set RAM, and doesn't
> trigger any GCs?

It does affect GC behaviour. According to the user's guide:

"
-Msize 
[Default: unlimited] Set the maximum heap size to size bytes. The heap normally grows and 
shrinks according to the memory requirements of the program. The only reason for having 
this option is to stop the heap growing without bound and filling up all the available 
swap space, which at the least will result in the program being summarily killed by the 
operating system.
The maximum heap size also affects other garbage collection parameters: when the amount of 
live data in the heap exceeds a certain fraction of the maximum heap size, compacting 
collection will be automatically enabled for the oldest generation, and the -F parameter 
will be reduced in order to avoid exceeding the maximum heap size."
 

Reducing the -F parameter (amount of memory reserved for the older generations as a factor 
of the amount of live data) triggers more GCs. So it tries to not exceed the limit you've 
given. You can indeed reduce the memory used by your programme via the -M option, but only 
to some extent. As far as I know it will not collect data held on to by live data to be 
reconstructed later if needed again.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091225/9e7ae9ed/attachment.html


More information about the Haskell-Cafe mailing list