rubenv / tripod

Top secret Banshee-based photo app project! Playground for new ideas that will land in F-Spot.
MIT License
5 stars 2 forks source link

Expire image surfaces #11

Open rubenv opened 14 years ago

rubenv commented 14 years ago

As Mike correctly pointed out, image surfaces are kept in the cache, which only keeps on growing.

This cache needs to become an LRUCache. Care has to be taken that the ImageSurfaces are correctly disposed (otherwise we leak memory).

Disposing the ImageSurface can only happen if no other thread is using it. All rendering happens on the mainloop. So when implementing this, override the ExpireItem method of LRUCache and proxy the dispose to the main loop, so it gets serialized with the rendering (and is thus safe).

We need to make sure that if an item is expired from the cache, that it will always get re-added.