Skip to content

Conversation

@kgibm
Copy link
Member

@kgibm kgibm commented Aug 18, 2025

Fixes #138

…rashing in getRetainedHeapTopConsumersDescription

Signed-off-by: Kevin Grigorenko <[email protected]>
@kgibm
Copy link
Member Author

kgibm commented Aug 18, 2025

@jasonk000 @krumts Please review if you have a chance or otherwise I'll commit in a few weeks. This was tested within IBM and the user confirmed the fix. All tests pass locally.

Copy link
Contributor

@jasonk000 jasonk000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

IObject object = snapshot.getObject(objectId);
String name = snapshot.isClass(objectId) ? ((IClass) object).getName() : object.getClazz().getName();

result.append(MessageUtil.format(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😎 great

Set<Entry<Integer, Long>> entries = sumHeapSizes.entrySet();
boolean multipleItems = entries.size() > 1 && topItems > 1;
PriorityQueue<Entry<String, Long>> pq = new PriorityQueue<Entry<String, Long>>(entries.size(),
PriorityQueue<Entry<Integer, Long>> pq = new PriorityQueue<Entry<Integer, Long>>(entries.size(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In hindsight, wondering if you found this PQ better than a sort?

Comment on lines +635 to +636
Map<Integer, Long> sumHeapSizes = new HashMap<>();
Map<Integer, Integer> counts = new HashMap<>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also have org.eclipse.mat.collect.HashMapIntLong as an option, to avoid the boxing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Performance regression in leak suspects report in getRetainedHeapTopConsumersDescription

2 participants