Re: More on releasing NSImages
Re: More on releasing NSImages
- Subject: Re: More on releasing NSImages
- From: publiclook <email@hidden>
- Date: Sat, 1 Mar 2003 19:06:50 -0500
Are you sure you really have a leak ? How are you detecting the leek ?
Are you considering that rep image caching may take place and the
cache won't shrink until later ? What is the class of the leaked
objects ? Have you used ObjectAlloc and NSDebug.h ?
On Saturday, March 1, 2003, at 05:01 PM, Simone Manganelli wrote:
Oops, sorry.. I do indeed release theNewDockImage right after I send
the new image to the dock, so that's not what's causing the memory
leak. I've also tried explicitly calling the Dock icon and then
trying to release it after I sent the new icon to be displayed, but I
got a crash indicating that the old dock image was already freed, so
that's not causing the problem either. This is really confusing me. > :(
-- Simone Manganelli
On Saturday, Mar 1, 2003, at 13:48 US/Pacific, Nicholas Riley wrote:
On Sat, Mar 01, 2003 at 12:57:21PM -0800, Simone Manganelli wrote:
I had a question in a previous e-mail asking if something special
needed to be done with NSImages before releasing them in order to not
have a memory leak. I've figured out that the memory leak comes in
during these lines of code, because if I comment them out the leak
isn't there:
NSImage *theNewDockImage = [[NSImage alloc]
initByReferencingFile:pathToIcon];
[theNewDockImage lockFocus];
[theNewImage drawInRect:NSMakeRect(0,0,128,128)
fromRect:NSMakeRect(0,0,128,128) operation:NSCompositeSourceOver
fraction:0.5];
[theNewDockImage unlockFocus];
[NSApp setApplicationIconImage:theNewDockImage];
I can't figure out what I'm doing wrong, though. Any suggestions?
You don't ever seem to release theNewDockImage; that would definitely
cause it to leak.
--
=Nicholas Riley <email@hidden> |
<http://www.uiuc.edu/ph/www/njriley>
Pablo Research Group, Department of Computer Science and
Medical Scholars Program, University of Illinois at Urbana-Champaign
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.