Bug 104094 - [CodeReaderCache] Leaks listeners
Summary: [CodeReaderCache] Leaks listeners
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-parser (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 RC3   Edit
Assignee: Devin Steffler CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2005-07-15 15:52 EDT by John Camelon CLA
Modified: 2008-06-19 13:20 EDT (History)
0 users

See Also:


Attachments
fix for this PR (1.46 KB, patch)
2005-07-18 10:27 EDT, Devin Steffler CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Camelon CLA 2005-07-15 15:52:35 EDT
public CodeReaderCache(int size) {
		cache = new CodeReaderLRUCache(size * MB_TO_KB_FACTOR);
		if (ResourcesPlugin.getWorkspace() != null)
			ResourcesPlugin.getWorkspace().addResourceChangeListener(new
UpdateCodeReaderCacheListener(this));
	}

UpdatedCodeReaderCacheListener is not saved as a member.  Thus, when the cache
is garbage collected it is not garbage collected.  You need to add a finalize()
method which removes the listener from the workspace.
Comment 1 Devin Steffler CLA 2005-07-18 10:27:26 EDT
Created attachment 24906 [details]
fix for this PR

Take a look at this when you get a minute.
Comment 2 John Camelon CLA 2005-07-18 10:41:12 EDT
Looks great! Applied.
Thanks!