write barrier and card marking

Y. Srinivas Ramakrishna y.s.ramakrishna at oracle.com
Sat Aug 14 11:25:39 PDT 2010


Tony,

Do you collect each generation independently, or
does a generation at level n (with youngest == 0)
collect all younger generations (i.e. level m < n)?

The usual failure pattern for missed remembered set entries
is that there is a "stale" pointer in a generation not collected
but with a pointer into a generation that was collected.
You can gainfully use the "mangling" feature in debug builds to
identify such cases sometimes. I have not generally seen null pointer
exceptions in such cases though (because that would mean that you are
getting hold of a null reference, which requires more work, i.e. clearing,
than forgetting to update an old reference to point to a new location),
just "broken" references to stale objects (these usually end up pointing
into the middle of unallocated space or into the middle of another object --
i.e. a location that was previously occupied by the object they were
previously pointing to).

Also use HeapVerifyBefore/AfterGC to get more visibility into the
problem.

best.
-- ramki

David Holmes wrote:
> Tony,
> 
> This is a GC question not a runtime question so I've cc'ed the GC list 
> and bcc'ed the runtime list.
> 
> David
> 
> Tony Guan said the following on 08/14/10 02:28:
>> Hi there,
>>
>> I wrote one collector of my own in hotspot, but now I have a problem.
>> In the new collector, I inserted another generation between the
>> defNewGeneration and TenuredGeneration. To collect this new
>> generation, I modified the defNewGeneration collector, which is gc by
>> copying survivors.
>>
>> After the collection on this generation, I am now having an Null
>> pointer exception in the java program. My guess is that the collector
>> failed to identify the live objects in the generation. Here I need
>> some one to tell me if there is any missed modification on the write
>> barrier or card marking.
>>
>> As far as I know, the write barrier works whenever a field write
>> happens, without regards to which generation is influenced. So this
>> means that the card of the written field will be marked. So my problem
>> should be in the closures that check if there are any live objects in
>> the generation. Am I right?
>>
>> Or other than the card scanning, is there anything special that I
>> should process?
>>
>> Thanks a lot!
>>
>>
>> Tony (Xiaohua Guan)



More information about the hotspot-gc-dev mailing list