[Haskell-cafe] Memory-aware Haskell?

John Van Enk vanenkj at gmail.com
Thu Dec 24 17:46:30 EST 2009

This is a problem with partitioned operating systems used in avionics. The
airplane computers require certain partitions to exist between programs in
both time and space. The space guarantees are most easily enforced by
eliminating any dynamic memory allocation once the operating system enters a
'normal mode'. This means that all memory needs to be allocated on the stack
and ahead of time.

This reduces the calculation of the upper memory bound to checking what the
largest possible stack a process could grow to is. Of course, calculating
this maximum stack is difficult in its own right.

Unfortunately, nothing I've just discussed seems to port well to Haskell (I
could be wrong!). Given this, I think you're looking at a very hard problem
(but one I'd be incredibly interested in discovering a solution for!).


On Thu, Dec 24, 2009 at 5:38 PM, Roman Cheplyaka <roma at ro-che.info> wrote:

> Imagine some system with hard memory bound (e.g. 64M of physical memory,
> no swap). I don't want some accidental laziness (maybe even not in my
> code, but in some used package) to crash my program.
> 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
> 2. apply some heuristics to find and reduce some chunks which will
>   benefit from reduction in terms of size
> 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.
> (And there still is a problem of foreign code whose memory consumption
> we know nothing about...)
> What do you think?
> --
> Roman I. Cheplyaka :: http://ro-che.info/
> "Don't let school get in the way of your education." - Mark Twain
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091224/adabf7ea/attachment.html

More information about the Haskell-Cafe mailing list