Bug 181215 - [Decorators] Image lives too long in OverlayCache
Summary: [Decorators] Image lives too long in OverlayCache
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.4 M5   Edit
Assignee: Tod Creasey CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
: 182399 185321 231160 (view as bug list)
Depends on: 182216 199460
Blocks:
  Show dependency tree
 
Reported: 2007-04-05 11:12 EDT by Christof Marti CLA
Modified: 2008-05-08 14:05 EDT (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christof Marti CLA 2007-04-05 11:12:02 EDT
3.3M5

The OverlayCache leaks the decorated image whenever the base image is disposed. This becomes a sever leak with editors that dispose all allocated resources when closing.
Comment 1 Tod Creasey CLA 2007-04-12 08:51:34 EDT
The OverlayCache is a remnant of the pre Resource Manager days and should be replaced by a ResourceManager.

The problem is knowing when the descriptor is obsolete. If we use a ResourceManager we have to hold onto the descriptor somehow or the cache will get cleared too often. 

We talked this over this morning and what makes the most sense to us is for someone to use an IDecorationContext for the caller to set a ResourceManager to use for a decoration.

We would then create our CompositeImageDescriptor in that ResourceManager. In cases where we are not passed a ResourceManager we would use a default one which would have the same lifecycle as what we have now.

Adding Stefan as he may have some good ideas in this space.
Comment 2 Tod Creasey CLA 2007-04-16 08:30:40 EDT
*** Bug 182399 has been marked as a duplicate of this bug. ***
Comment 3 Tod Creasey CLA 2007-05-04 07:58:02 EDT
*** Bug 185321 has been marked as a duplicate of this bug. ***
Comment 4 Markus Keller CLA 2007-08-10 05:20:22 EDT
(In reply to comment #0)
> The OverlayCache leaks the decorated image whenever the base image is disposed.

This problem should be fixed with bug 175526 comment 10.

However, I think there are still more lifecycle issues in OverlayCache, see e.g. bug 185321 comment 1.
Comment 5 Tod Creasey CLA 2008-01-22 12:45:27 EST
*** Bug 216146 has been marked as a duplicate of this bug. ***
Comment 6 Tod Creasey CLA 2008-01-28 13:37:02 EST
I would like a solution that works with the new ColumnLabelProvider. See Bug 182216
Comment 7 Tod Creasey CLA 2008-01-29 10:37:03 EST
After a design discussion with Michael Valenta we have come up with a light weight solution that most users of decorators will get for free.

I have added a key to DecorationContext called RESOURCE_MANAGER_KEY. If the context has a ResourceManager at RESOURCE_MANAGER_KEY we will now use this manager instead of the global one when caching our overlays. The global one is still there for contexts that do not provide a ResourceManager.

The DecoratingLabelProvider provides one for free in it's default decoration context (we used the empty singleton before). 

For DecoratingLabelProviders that supply thier own (like JDTs) they will need to make a LocalResourceManager for us to use if they want this support. Note that this  manager will be disposed when the DecoratingLabelProvider so make sure it is a local one backed one the one you are using.

Released for build >20080129 (and thanks again Michael).
Comment 8 Tod Creasey CLA 2008-02-05 10:09:17 EST
Verified in I20080205-0800
Comment 9 Tod Creasey CLA 2008-02-12 10:43:27 EST
Jason please look at a test suite for this
Comment 10 Tod Creasey CLA 2008-02-25 14:02:31 EST
Test suite added for build > 20080225
Comment 11 Tod Creasey CLA 2008-05-08 14:05:19 EDT
*** Bug 231160 has been marked as a duplicate of this bug. ***