This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 250636 - Memory leak in debugger
Summary: Memory leak in debugger
Status: RESOLVED FIXED
Alias: None
Product: debugger
Classification: Unclassified
Component: Java (show other bugs)
Version: 8.0
Hardware: All All
: P2 normal with 3 votes (vote)
Assignee: Martin Entlicher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-23 15:30 UTC by Martin Entlicher
Modified: 2016-04-23 14:02 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Reference root (2.74 KB, text/plain)
2015-02-23 15:30 UTC, Martin Entlicher
Details
Test case (4.34 MB, application/x-bzip)
2016-04-22 13:18 UTC, scanti
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Entlicher 2015-02-23 15:30:57 UTC
Created attachment 152164 [details]
Reference root

Finished debugger session retains in memory due to a leak caused by org.netbeans.modules.debugger.ui.models.WatchesTreeModel, which in it's "listeners" field holds Models.CompoundTreeModel delegating to the JPDA's WatchesModel and JPDADebuggerImpl.
Comment 1 Martin Entlicher 2015-05-13 14:05:06 UTC
Fixed by changeset:   287723:72e61818969b
http://hg.netbeans.org/core-main/rev/72e61818969b
Comment 2 Quality Engineering 2015-05-14 03:08:16 UTC
Integrated into 'main-silver', will be available in build *201505140001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/72e61818969b
User: mentlicher@netbeans.org
Log: #250636: Assure that the JPDADebuggerImpl instance is not held strong after the session finishes.
Comment 3 Quality Engineering 2015-05-17 05:24:32 UTC
Integrated into 'main-silver', will be available in build *201505170001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/15bffbbd85ef
User: mentlicher@netbeans.org
Log: #250636: Additional fix to enable to free the debugger session-related objects from memory.
Comment 4 scanti 2016-04-22 13:18:02 UTC
Created attachment 159398 [details]
Test case
Comment 5 scanti 2016-04-22 13:31:24 UTC
We are using your OutlineView Model in our RCP application and when we moved to NB RCP 8.1 we found out that maximizing the TopComponent in whom the OutlineView was put, made the OutlineView resets its model. This also happens when you drag the  TopComponent to another mode. 

We took a look at the code and we noticed that you call setModel(null) in the removeNotify method of org.netbeans.modules.viewmodel2.OutlineTable. 

We understand that you do this to avoid memory leaks, but this is giving us some problems. IMHO it should the one that sets the model to reset it and not be hidden in the API (see org.netbeans.modules.debugger.ui.views,View where only addNotify is overridden) .

We made a workaround in our application and we are looking forward to see a better fix in the future.
Comment 6 markiewb 2016-04-23 14:02:38 UTC
(In reply to scanti from comment #5)
> We are using your OutlineView Model in our RCP application and when we moved
> to NB RCP 8.1 we found out that maximizing the TopComponent in whom the
> OutlineView was put, made the OutlineView resets its model. This also
> happens when you drag the  TopComponent to another mode. 
> 
> We took a look at the code and we noticed that you call setModel(null) in
> the removeNotify method of org.netbeans.modules.viewmodel2.OutlineTable. 
> 
> We understand that you do this to avoid memory leaks, but this is giving us
> some problems. IMHO it should the one that sets the model to reset it and
> not be hidden in the API (see org.netbeans.modules.debugger.ui.views,View
> where only addNotify is overridden) .
> 
> We made a workaround in our application and we are looking forward to see a
> better fix in the future.

@scanti:
Reopening a fixed issue from a released version won't get the attention you want. Please file a new issue and refer to this one. 

BTW: Document your workaround in the issue, so other developers can adapt your workaround too.

Reverting state to resolved fixed.