General Problems for GC'ed Applications?
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Thu Jul 27 14:15:04 PDT 2006
Sean Kelly wrote:
> Frits van Bommel wrote:
>> Sean Kelly wrote:
>>> By the way, there's no reason that even a full collect must swap
all 0.8 GB back in. Some GCs use an alternate approach where pages are
scanned and marked stale when the VMM swaps them to disk, so no page
faults occur on collection runs.
>>
>> I only know of one such collector, and it required a specially
patched (Linux) kernel that notifies a process before it swaps its pages
to disk and allows it to specify which pages to swap (since it touches
the pages on receiving the swap warning, which for a normal LRU-like
scheme stops it from being swapped).
>
> Yes, the scheme isn't supported everywhere, though I had thought it
was possible on Linux without a kernel patch.
The one I was talking about is described in
http://www.cs.umass.edu/~emery/pubs/04-16.pdf (and at least one other
paper at http://www.cs.umass.edu/~emery/pubs/). A quote from page 5:
-----
4. Kernel Support
The Hippocratic collector improves garbage collection paging performance
primarily by cooperating with the virtual memory manager. In this
section, we describe our extensions to the Linux kernel that enable
cooperative garbage collection.
[...]
-----
Of course, it is entirely possible that their patch or one with similar
effects has been accepted in the kernel since then.
>> Also, that particular GC would sometimes do an actual full collect
of the memory, since otherwise swapped-out garbage might never be collected.
>
> True. It would be somewhat similar to a generational GC in some
respects, with stale pages representing "mature" data.
Yep, except instead of the objects in them having existed for a long
time they haven't been touched in a while (which I suppose implies
they've existed for all that time :) ).
One of the other cool thing this collector does IIRC: it tries to move
all objects out of a page that's scheduled to be swapped out if there's
space in other (memory resident) pages. If that's successful it then
tells the kernel to forget about saving the contents to disk since they
won't be needed anymore.
More information about the Digitalmars-d
mailing list