-
Notifications
You must be signed in to change notification settings - Fork 30
Description
PR #115 for issue #114 calculates statistics on the minimum retained sets of leak suspects. A user reported that dumps are taking hours longer to run the leak suspects report and MAT was often in this stack:
at org/eclipse/mat/collect/HashMapIntObject.remove(HashMapIntObject.java:176(Compiled Code))
at org/eclipse/mat/parser/internal/snapshot/ObjectCache.removeLeastValuableNode(ObjectCache.java:129(Compiled Code))
at org/eclipse/mat/parser/internal/snapshot/ObjectCache.get(ObjectCache.java:60(Compiled Code))
at org/eclipse/mat/parser/internal/SnapshotImpl.getObject(SnapshotImpl.java:1606(Compiled Code))
at org/eclipse/mat/inspections/LeakHunterQuery.getRetainedHeapTopConsumersDescription(LeakHunterQuery.java:639(Compiled Code))
at org/eclipse/mat/inspections/LeakHunterQuery.getLeakDescriptionGroupOfObjects(LeakHunterQuery.java:755)
at org/eclipse/mat/inspections/LeakHunterQuery.getLeakSuspectDescription(LeakHunterQuery.java:296)
at org/eclipse/mat/inspections/LeakHunterQuery.execute(LeakHunterQuery.java:197)
at org/eclipse/mat/query/registry/ArgumentSet.execute(ArgumentSet.java:147)
at org/eclipse/mat/query/registry/CommandLine.execute(CommandLine.java:95)
at org/eclipse/mat/report/internal/QueryPart.execute(QueryPart.java:109)
at org/eclipse/mat/report/internal/SectionPart.execute(SectionPart.java:70)
at org/eclipse/mat/report/TestSuite.execute(TestSuite.java:134)
at org/eclipse/mat/report/internal/RunRegisterdReport.execute(RunRegisterdReport.java:66)
at org/eclipse/mat/query/registry/ArgumentSet.execute(ArgumentSet.java:147)
at org/eclipse/mat/ui/QueryExecution$ExecutionJob.run(QueryExecution.java:209)
at org/eclipse/core/internal/jobs/Worker.run(Worker.java:63)
getRetainedHeapTopConsumersDescription is calling ISnapshot.getObject for each object in the minimum retained set to get the class name of the object and use that as the key to calculate the statistics based off of. Although ISnapshot.getObject states, "Performance: Relatively fast - single index operation", SnapshotImpl.getObject uses org.eclipse.mat.parser.internal.SnapshotImpl.HeapObjectCache and this uses a fixed size of 1,000:
mat/plugins/org.eclipse.mat.parser/src/org/eclipse/mat/parser/internal/SnapshotImpl.java
Line 418 in e93789c
| this.objectCache = new HeapObjectCache(this, 1000); |
For leak suspects with minimum retained sets with a lot of objects, this is thrashing this cache.
The object/class name isn't needed except for the display, so we can simply use the objectId instead as the key for statistics calculation.