garbage collection

Duncan Coutts duncan.coutts at
Thu Apr 21 09:36:28 EDT 2005

On Thu, 2005-04-21 at 10:57 +0100, Simon Marlow wrote:
> I mentioned madvise() above: this is a compromise solution which
> involves telling the kernel that the data in memory is not relevant, but
> doesn't actually free the memory.  The kernel is free to discard the
> pages if memory gets tight, without actually swapping them to disk.
> When the memory is faulted in again, it gets filled with zeros.  This is
> ideal for copying GC: you madvise() the semispace you just copied from,
> because it contains junk.
> IIRC, madvise() is a BSD-ish interface, but other OSs probably have
> similar facilities.

Linux and Solaris have this interface (Solaris with possibly different

And there is also a standardised posix_madvise() (that no-one seems to

That probably covers it for unixy(linux,solaris,*bsd,darwin) systems.
Don't know about win32.


More information about the Glasgow-haskell-users mailing list