Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 340349 - With IBM PHD, gc root not calculated if object points to itself
Summary: With IBM PHD, gc root not calculated if object points to itself
Status: RESOLVED FIXED
Alias: None
Product: MAT
Classification: Tools
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-17 13:05 EDT by Brian Peacock CLA
Modified: 2011-04-04 11:49 EDT (History)
1 user (show)

See Also:


Attachments
Patch to stop obj pointing to itself not being gcroot elligible (582 bytes, patch)
2011-03-17 13:10 EDT, Brian Peacock CLA
andrew_johnson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Peacock CLA 2011-03-17 13:05:51 EDT
Build Identifier: 

The code in the DTFJIndexBuilder that calculates the gcroots when using a PHD (heapdump which doesn't contain root information) it assumes that if nothing points to an object it is a gc root. However, the current code assumes that if the object points to itself it is pointed to by something and thus cannot be a gc root.

To fix it a simple "if points to itself don't assume this is not a root' needs to be added to addRefs()

Reproducible: Always
Comment 1 Brian Peacock CLA 2011-03-17 13:10:09 EDT
Created attachment 191445 [details]
Patch to stop obj pointing to itself not being gcroot elligible
Comment 2 Andrew Johnson CLA 2011-03-21 05:50:43 EDT
Thanks - that's a useful point. It makes no difference to the two test case dumps
/org.eclipse.mat.tests/dumps/heapdump.20100112.141124.11580.0002.phd
/org.eclipse.mat.tests/dumps/heapdump.20100209.165721.4484.phd
but might be useful for other dumps.

For the record, please could you confirm for the patch:
1.that you wrote 100% of the code
2.that you are authorized to contribute it
3.that is is submitted under the EPL.
This is needed so we can use the patch.
Comment 3 Brian Peacock CLA 2011-03-28 04:08:26 EDT
> For the record, please could you confirm for the patch:
> 1.that you wrote 100% of the code
Yes
> 2.that you are authorized to contribute it
Yes
> 3.that is is submitted under the EPL.
Yes
Comment 4 Andrew Johnson CLA 2011-03-28 10:03:16 EDT
I'll also make the corresponding change to GarbageCleaner.java which also calculates extra GC roots for otherwise unreachable objects.
Comment 5 Andrew Johnson CLA 2011-04-04 11:48:42 EDT
I've also improved the selection of extra GC roots in GarbageCleaner for keep_unreachable_objects.