Re: cut strech new Bitmap
Re: cut strech new Bitmap
- Subject: Re: cut strech new Bitmap
- From: email@hidden
- Date: Tue, 04 Dec 2007 07:39:30 -0800
Thanks for pointing out the need for using retain, and make nested autorelease pools.
My app will keep some image objects for later usage. And also many images are created in loops.
Very conveniently I could verify this in the ADC documentation.
http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/index.html?http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Concepts/AutoreleasePools.html
"Cocoa?s ownership policy specifies that received objects should remain valid throughout the scope of the calling method"
"If you write a loop that creates many temporary objects, you may create an autorelease pool inside the loop to dispose of those objects before the next iteration. This can help reduce the maximum memory footprint of the application."
>1. If you want to keep one of the generated NSBitmapImageRep objects
>after you've finished processing the current event, you should -retain
>it and then -release it when you're done.
>
>2. If you are calling this method in a loop, you *might* need to think
>about creating your own autorelease pool and periodically emptying it;
>otherwise you'll continue to use-up memory during the loop and it will
>only be released when you get back to the application's run loop.
>
>Kind regards,
>
>Alastair.
>
>--
>http://alastairs-place.net
>
>
>
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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