Am Donnerstag 07 Mai 2009 22:01:11 schrieb Andrew Coppin: > Simon Marlow wrote: > > http://hackage.haskell.org/trac/ghc/ticket/698 > > I presume that the reason for this is to avoid handing memory back only > to immediately need it again? (I.e., we don't want to be constantly > asking the OS to allocate and deallocate memory. Allocate it once and > then let the RTS handle it.) > > How hard would it be to add a function to ask the RTS to shrink the > allocated memory? E.g., you do something that you know consumes lots of > RAM, you finish doing it, you know that your live set has probably gone > way down now, so you ask the RTS to release some RAM if possible. Would > that be difficult?
Another idea, I have no idea how hard or sensible it is: What if the GC detects how much memory is currently used (it does already do that, doesn't it?) and how much is allocated from the OS, and if less than a third or a quarter of the allocated memory is used, return the memory that exceeds twice the used memory to the OS? Behaviour might be configurable by an RTS flag. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe