On 15.06.2014 23:30, Martin Nowak wrote:
On 06/04/2014 10:37 PM, Rainer Schuetze wrote:
Most of the remaining pause time is sweeping garbage. I think about
deferring sweeping into allocations by running finalizers just before
reusing the memory for another object. This can throttle allocations a
bit while at the same time reduce pauses.
That's pausing the thread which triggered the collection, right?
Other threads don't need to wait for sweeping.
Yes, the world is not stopped during sweeping. The GC lock still blocks
any thread that tries to allocate, though.
Dividing the cost to run finalizers among many allocations is a charming
idea.
Another nice property: If memory is recycled during malloc, you can run
the finalizers without the GC lock held just before returning, so there
are less restrictions on what can happen in a destructor.