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 28256 - Leak in EditorSupport.Editor (node listeners)
Summary: Leak in EditorSupport.Editor (node listeners)
Status: CLOSED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Text (show other bugs)
Version: 3.x
Hardware: All All
: P3 blocker (vote)
Assignee: Peter Zavadsky
URL:
Keywords: PERFORMANCE
Depends on:
Blocks: 27563
  Show dependency tree
 
Reported: 2002-10-24 17:24 UTC by Tomas Pavek
Modified: 2008-12-22 17:52 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
allocation stack trace (2.13 KB, text/html)
2002-10-24 17:29 UTC, Tomas Pavek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Pavek 2002-10-24 17:24:27 UTC
In constructor of EditorSupport.Editor (rev 1.172), a 
WeakListener holding EditorSupport.del is created and 
added to node. With each opening of java file, the same 
EditorSupport.del is added to the node (via WeakListener), 
but is not removed, as EditorSupport.del is quite long-
lived (referenced from DataObject).
The memory leak itself is quite small here, and the 
potential performance problem does not show up (as the 
user normally does not close/open the same file many 
times), but it is a leak, and also an example of 
WeakListener misuse...
Comment 1 Tomas Pavek 2002-10-24 17:29:32 UTC
Created attachment 7762 [details]
allocation stack trace
Comment 2 Petr Nejedly 2002-10-29 14:01:18 UTC
There are three entities:
Node (long living object)
EditorSupport$Del (long living object)
EditorSupport$Editor (relatively to the above short living object)

IMO no 3rd party (Editor) should attach a foreign listener (Del)
to an object of its interrest (Node).
(Editor is spamming a Del by events from Node ;-)

Either the Del is interrested in events on Node and then it should
subscribe itself (and only once).

If only Editor is interrested in these events (and I believe this is
the case - it does forward icon/title changes to TopComponents (the
Editors)) then it should listen itself.
Comment 3 Peter Zavadsky 2002-10-29 16:06:59 UTC
Similar cause to issue #27645, even the consequences are different.
I'm going to solve it the same way.

Hm, the text package is really messy :-(.
Comment 4 Peter Zavadsky 2002-10-29 17:15:54 UTC
Fixed in [trunk]

openide/../text/EditorSupport.java 1.173
Comment 5 Marian Mirilovic 2004-08-26 13:33:04 UTC
verified/closed