[Haskell-cafe] Memory-aware Haskell?

Svein Ove Aas svein.ove at aas.no
Fri Dec 25 05:14:26 EST 2009


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.

> 2. apply some heuristics to find and reduce some chunks which will
>   benefit from reduction in terms of size
>
For example, by un-evaluating them. It would often be possible to
reduce size like that, just so long as they aren't evaluated again the
next second. Well, this one would be hard.

> 3. if nothing helps, throw an exeption. It can be caught in IO and
>   memory-aware program can make apropriate decision -- e.g. abort
>   opening a large file and gracefully warn the user.
>
That should be relative simple. Get implementing, will you?:D

> (And there still is a problem of foreign code whose memory consumption
> we know nothing about...)
>
In theory, you could deal with that by hooking malloc.

-- 
Svein Ove Aas


More information about the Haskell-Cafe mailing list