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