Make FeatureListenerManager less memory leak prone
--------------------------------------------------
Key: GEOT-1668
URL: http://jira.codehaus.org/browse/GEOT-1668
Project: GeoTools
Issue Type: Improvement
Components: core main
Affects Versions: 2.5-M0, 2.4-RC0
Reporter: Andrea Aime
Assignee: Jody Garnett
Fix For: 2.4-RC1, 2.5-M1
FeatureListenerManager uses a standard hashmap to hold the list of event
listener lists keyed by FeatureSource.
If the user is making map context, the list will be populated by
DefaultMapLayer source listeners, with the default map layer pointing at the
feature source as well. This means that if the map context does not get cleared
by the application after usage, we have a memory leak around (both the map
context and the feature source end up being held by the feature listener
manager).
Turning the hashmap into a weak hash map does not help, since the
EventListenerLists are still kept by strong references (weak hash map has weak
references only on keys).
We need that, and a listener list that referes to the listeners thru weak
references.
This is possible, but unfortunately, for some strange reason, the
FeatureListenerManager.eventListenerList is public, making it harder to change
the class to use a flat arraylist of WeakReference<FeatureListener>.
What shall we do? Deprecate the method, replace it with an internal one
playing with List<WeakReference<FeatureListener>>, and build an
EventListernList on the fly is someone is still calling
the old public one?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel