eclipse-mat / mat

The Eclipse Memory Analyzer is a fast and feature-rich Java heap dump analyzer that helps you find memory leaks and reduce memory consumption.
https://eclipse.dev/mat/
Eclipse Public License 2.0
86 stars 14 forks source link

Add SWT smarts to inspector #3

Open eclipsewebmaster opened 6 months ago

eclipsewebmaster commented 6 months ago

| --- | --- | | Bugzilla Link | 274369 | | Status | ASSIGNED | | Importance | P3 enhancement | | Reported | Apr 29, 2009 14:35 EDT | | Modified | May 22, 2013 04:52 EDT | | Reporter | Chris Grindstaff |

Description

Created attachment 133810\ proposed patch

This patch updates the inspector so you can easily tell if an object is an SWT widget and whether or not the object has been disposed. I've found this useful when tracking down memory leaks related to leaking listeners and widget references.

:notepad_spiral: InspectorView_SWT_objects.patch

eclipsewebmaster commented 6 months ago

By Chris Grindstaff on Apr 29, 2009 14:36

Created attachment 133811 swt image

instance_obj_swt.gif

instance_obj_swt.gif

eclipsewebmaster commented 6 months ago

By Chris Grindstaff on Apr 29, 2009 14:36

Created attachment 133812 swt disposed image

instance_obj_swt_disposed.gif

instance_obj_swt_disposed.gif

eclipsewebmaster commented 6 months ago

By Mariot Chauvin on Apr 30, 2009 07:09

+1 for this feature

eclipsewebmaster commented 6 months ago

By Stefan Röck on Jun 22, 2009 06:43

Cool feature. \ Looking at the code: why don't you call Widget#isDisposed() for the check?

eclipsewebmaster commented 6 months ago

By Andreas Buchen on Jun 22, 2009 07:18

(In reply to comment #4)

Looking at the code: why don't you call Widget#isDisposed() for the check?

Well the heap is always post-mortem - one cannot call methods on the objects because the objects do not live anymore.

We'll take a look at this feature for the next service release. I did not submit the patch, because the only the image in the object inspector is changed, not in the object lists itself. I thought it might be confusing if different icons are used for one and the same object.

eclipsewebmaster commented 6 months ago

By Stefan Röck on Jun 22, 2009 08:59

Ok, I understand. I was asking because I didn't find the code where the display instance is set to null in the Widget.java implementation of RAP. But as Benny is already on CC list, I don't worry about this anymore :-)

eclipsewebmaster commented 6 months ago

By Andrew Johnson on Mar 01, 2011 08:49

Another way of doing this would be to have an extension point which returned an icon for an object, rather like a name resolver. This could then be added to Icons.forObject and ideally Icons for object would do the adding of GC roots and inbound/outbound decorators.