
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 flags MADV_DONTNEED/MADV_FREE). And there is also a standardised posix_madvise() (that no-one seems to support!) That probably covers it for unixy(linux,solaris,*bsd,darwin) systems. Don't know about win32. Duncan