Clear CGColor cache on memory pressure.
Created attachment 392182 [details] Patch
How much of it do we just fill up again when we paint? I think this blanket "clear cache on memory pressure" will often just dirty more pages than we save.
Comment on attachment 392182 [details] Patch Will gather some data as this appears to be controversial.
Comment on attachment 392182 [details] Patch There’s an NSColor one just like this. Should we be clearing it too?
If we decide to clear either.
I just found SubimageCacheWithTimer, which isn't cleared at all on a memory warning (bug 207957). I still think our cache management needs to be more centralized.
(In reply to Simon Fraser (smfr) from comment #6) > I still think our cache management needs to be more centralized. Sounds good! But what does it mean?
Off the cuff: * every cache derives from a common base class, registers itself with a cache controller. This would make it harder for people to forget to handle new caches on memory pressure. * cache controller decides how to reduce in size or clear caches based on memory pressure. Maybe caches have some knobs that describe their time/memory trade-offs More general goals: * if clearing caches involves mapping in more memory pages than would be saved, then don't do it (probably requires empirical measurement) * rewrite caches to make it easier to dump memory pages without touching them