ghc releasing memory during compilation

Simon Marlow simonmarhaskell at
Mon Mar 13 09:02:04 EST 2006

Bulat Ziganshin wrote:

> SM> I think what you're suggesting is that the runtime should detect the 
> SM> amount of physical memory on the system and auto-tune itself to switch
> SM> to compacting collection when its residency reaches that amount.  This
> SM> is certainly something we could do.  Bear in mind that GHC is not 
> SM> necessarily the only process running on the machine, though, and what 
> SM> about running multiple GHCs?
> i suggest checking of AVAILABLE physical ram, that is perfectly
> possible in windows

Ok, fair enough

> SM> Also, you can do this by setting your GHC_RTS environment variable. 
> SM> Suppose you have 1G of physical mem.  You want GHC to give up when it 
> SM> reaches 1.5G, and you want to switch to compacting collection when the
> SM> residency reaches 300M.  You could do this:
> SM> export GHC_RTS='-M1.5G -c20'
> SM> because 300M is 20% of 1.5G.  Perhaps a better interface would be to 
> SM> allow you to specify exactly the residency at which to switch to compaction.
> you mix up two questions:
> 1) switching from copying to compacting algorithm
> 2) return memory to OS after GC

No, I was just talking about (1).  See my other replies in this thread 
for comments about (2).


More information about the Glasgow-haskell-users mailing list