[Haskell-cafe] GHC 7.0.1 developer challenges

Simon Marlow marlowsd at gmail.com
Wed Dec 15 13:59:15 CET 2010


On 13/12/2010 15:45, Peter Simons wrote:
> Hi Mathieu,
>
>   >  Why don't you use ulimit for this job?
>   >
>   >  $ ulimit -m 32M; ./cpsa
>
> yes, I was thinking the same thing. Relying exclusively on GHC's ability to
> limit run-time memory consumption feels like an odd choice for this task.
> It's nice that this feature exists in GHC, but it's inherently non-portable
> and outside of the scope of the language. There really ought to be a better
> way to catch an infinite loop that this.

ulimit is a good way to catch an infinite loop.  But it's not a good way 
to tell GHC how much memory you want to use - if GHC knows the memory 
limit, then it can make much more intelligent decisions about how to 
manage memory.  The -M flag causes the GC algorithm to switch from 
copying (fast but hungry) to compaction (slow but frugal) as the limit 
approaches.

Cheers,
	Simon



More information about the Haskell-Cafe mailing list