[Solved]RE: The released object is not releasing memory
[Solved]RE: The released object is not releasing memory
- Subject: [Solved]RE: The released object is not releasing memory
- From: Vinay Prabhu <email@hidden>
- Date: Tue, 15 May 2007 12:20:02 +0530
- Importance: Normal
I have created a autorelease pool object just before creting the graphics
context and
released the autorelease pool, after calling the restoreGraphicsState.
This brought back the retainCount for "bmp" to 1.
Thanks for all the help.
-Vinay
-----Original Message-----
From: Scott Ribe [mailto:email@hidden]
Sent: Monday, May 14, 2007 8:44 PM
To: Vinay Prabhu; email@hidden
Subject: Re: The released object is not releasing memory
> I have checked for retainCount for "bmp" before releasing it. The retain
> count is 2.
Yes, it was probably retained by graphicsContextWithBitmapImageRep because
the context will need the rep during the context's lifetime. Note that
graphicsContextWithBitmapImageRep returns a context which has been
autoreleased, and therefore won't be freed, and therefore won't release its
reference to the rep, until after your code has run and control returns to
the event loop. (The setCurrentContext and restoreGraphicsState calls
probably retain and release the context you created, but they might retain
and autorelease.)
You need to stop trying to outguess the libraries' memory management and
study this until you understand it:
<http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/index.
html>
--
Scott Ribe
email@hidden
http://www.killerbytes.com/
(303) 722-0567 voice
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden