[darcs-users] Current Pull Attempting to Overallocate

David Roundy droundy at jdj5.mit.edu
Thu Jan 29 12:29:21 UTC 2004

On Wed, Jan 28, 2004 at 07:24:13PM +0100, Ketil Malde wrote:
> David Roundy <droundy at jdj5.mit.edu> writes:
> > This is a very ugly trick, which I'll probably have to give up on.  The
> > problem it tried to fix was that the ghc garbage collector never decreases
> > the size of its heap, which means that if darcs ever grows its ghc heap
> > beyond the amount of RAM available, it will be forever swapping until it
> > exits, even if the amount of memory actually used goes back down.
> Interesting - I have a similar problem; in that my program allocates
> too much memory and keeps thrashing.  Ideally, I'd like to detect the
> amount of RAM dynamically, and do the equivalent of the RTS option
> limiting the heap size to physical memory size.  I don't think this is
> currently possible with GHC, perhaps we could bug the maintainers for
> the functionality?  (I'd rather have my application abort, than swap
> close to forever...)

You could check out darcs' rts.c, which pretty much does what you want, and
seems to be sufficiently cross-platform that at least it doesn't fail to
compile on windows.  It's more complicated than it needs to be, but
basically it just defines defaultsHook, which is what ghc uses to decide on
its default RTS values.  I've disabled it recently, because it ends up
making it hard to track down GC bugs, since darcs' behavior then depends on
how much system memory there is.
David Roundy

More information about the darcs-users mailing list