Skip navigation.
 
mlRe: Fixing my massive memory leak with NSImage/CALayer
FROM : Nathan Vander Wilt
DATE : Wed Apr 02 04:47:44 2008

On Apr 1, 2008, at 4:24 PM, Jens Alfke wrote:
> On 1 Apr '08, at 11:07 AM, Nathan Vander Wilt wrote:
>

>> The NSImage that my FRPhoto holds on to should have "invalidate[d] 
>> and free[d] the offscreen caches of all image representations".

>
> That doesn't mean the image representations themselves are flushed, 
> though. They're still there, typically holding onto big uncompressed 
> pixmaps. All -recache does is flush extra copies of those pixmaps 
> that were copied into VRAM to speed up blitting.
>
> If you want the pixmaps out of memory, you have to dealloc the 
> NSImages themselves.


Okay, I was confusing "representations" with "caches" -- using lazy 
initialization for the representations is equivalent to allocating the 
representations eventually. A more careful reading of http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaDrawingGuide/Images/chapter_7_section_2.html
  explains "-recache" in the correct context. Looks like I'll have to 
design a smarter architecture to keep the right images in memory at 
the right time.

It was really frustrating to see my app balloon up like that without 
understanding what was going on. Thanks much for your help!

-natevw

Related mailsAuthorDate
mlFixing my massive memory leak with NSImage/CALayer Nathan Vander Wilt Apr 1, 20:07
mlRe: Fixing my massive memory leak with NSImage/CALayer Jens Alfke Apr 2, 01:24
mlRe: Fixing my massive memory leak with NSImage/CALayer Nathan Vander Wilt Apr 2, 04:47
mlRe: Fixing my massive memory leak with NSImage/CALayer Jens Alfke Apr 2, 07:32