Bug 72977 - Leaks from Inspect popup
Summary: Leaks from Inspect popup
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: 3.1 M7   Edit
Assignee: Platform-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on: 72374
Blocks:
  Show dependency tree
 
Reported: 2004-08-31 12:15 EDT by Darin Swanson CLA
Modified: 2005-04-27 09:21 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Swanson CLA 2004-08-31 12:15:52 EDT
For each inspect popup numerous objects are leaked.
It appears the root of the leaks is the failure to dispose/uninstall the 
InformationPresenter. 

When I add this though I get:

java.lang.NullPointerException
at org.eclipse.debug.internal.ui.LazyModelPresentation.removeListener
(LazyModelPresentation.java:162)
at org.eclipse.debug.internal.ui.DelegatingModelPresentation.removeListener
(DelegatingModelPresentation.java:243)
at org.eclipse.jface.viewers.ContentViewer.handleDispose
(ContentViewer.java:152)
...
Comment 1 Darin Swanson CLA 2004-08-31 12:25:36 EDT
So with the uninstall, the LazyModelPresentation is disposed via the 
ExpressionInfoControl dispose (via the new uninstall code). 
But then when the VariablesViewer is disposed (when the popup is closed), a 
listener is attempted to be removed from the LazyModelPresentation but the 
listener collection has already been nulled out --> NPE
Comment 2 Kevin Barnes CLA 2004-09-02 11:21:49 EDT
Instead of calling dispose() on the Information Control, we should be calling uninstall on the 
Information Presenter (which will call dispose for us).
Fixed in PopupInformationControl, PopupDisplayAction, and PopupInspectAction.
Comment 3 Kevin Barnes CLA 2004-09-02 11:22:17 EDT
Darins, please verify
Comment 4 Darin Swanson CLA 2004-09-02 19:35:11 EDT
Things are better but still for each inspect we are leaking 1 
AbstractInformationControlManager$1 and 1 InformationPresenter and the 
reference appears to be from the instance variable fInformationPresenter of 
the PopupInspectAction. Sorry I have run out of time to look into this tonight 
but I thought I would put these findings out there for you.
Comment 5 Darin Swanson CLA 2004-09-02 19:39:10 EDT
Actually it could be that the listener (AbstractInformationControlManager$1) 
is still not getting removed as an event listener (added on line 430 of 
AbstractInformationControlManager.install)
Comment 6 Kevin Barnes CLA 2004-11-12 12:37:56 EST
Hoping to move the debug popups to generic framework provided by UI team. See Bug #72374
Comment 7 Tod Creasey CLA 2005-03-07 11:57:15 EST
Adding my name to the cc list as we are now tracking performance issues more
closely. Please remove the performance keyword if this is not a performance bug.
Comment 8 Mike Wilson CLA 2005-04-25 11:02:59 EDT
Have the remaining leaks been fixed?
Comment 9 Kevin Barnes CLA 2005-04-25 11:43:21 EDT
The remaining leak is in AbstractInformationControlManager's install(). A dispose listener is added to 
the control and is not removed by uninstall() or dispose().
Moving to TEXT for comment.
Comment 10 Dani Megert CLA 2005-04-25 12:05:20 EDT
Can you clarify? The listener is added to the Widget. The widget nulls out the
eventTable upon dispose. Do you have dump from a profiler that shows the
allocation path?
Comment 11 Kevin Barnes CLA 2005-04-25 14:16:33 EDT
We install the InformationPresenter on a TextViewer when the user executes the popup Inspect action. 
When the popup is dismissed, the listener is not removed because the TextViewer's Widget is not 
disposed. Closing the viewer probably does clean up anything left over.
See DarinS' comment #4 for details of what is being leaked.
Sorry, no dump from a profiler. Waiting for a new license still.
Comment 12 Dani Megert CLA 2005-04-27 06:28:32 EDT
Reopening for investigation.
Comment 13 Dani Megert CLA 2005-04-27 07:05:47 EDT
I've added code to remove the listener and profiled it with I20050426-1700 plus
my fix and could no longer detect leaks by using Run > Inspect (Ctrl+Shift+I).

Please note that creating (and afterwards disposing) the information control
manager for every single popup isn't efficient. The idea is to install it once
on the subject control. Please consider fixing this on your part.
Comment 14 Darin Wright CLA 2005-04-27 09:21:13 EDT
This bug should be marked as fixed, as the leak is fixed. A new bug should be 
opened for the issue of re-creating the popup on each inpsect.
Comment 15 Darin Wright CLA 2005-04-27 09:21:30 EDT
Marking as fixed.