Release autoreleased object now
Release autoreleased object now
- Subject: Release autoreleased object now
- From: Jonny Taylor <email@hidden>
- Date: Fri, 8 Oct 2010 17:58:20 +0100
Is there a way of forcing an autoreleased object to be released right now? I am encountering problems in my image processing code where I am receiving (and later discarding) a lot of large blocks of autoreleased memory in a loop. This is not getting cleaned up until the end of the loop (when I drop back into the run loop) and I am running out of memory.
The problem is coming from OS functions such as [image TIFFRepresentation] that return autoreleased objects, so it is obviously considered ok to autorelease large chunks of memory. My question is whether I can tell the OS to release the memory *now* rather than waiting until the pool is drained. At the moment I am bracketing the relevant parts with my own autorelease pools, but that is getting a bit tedious. I would like just to be able to call [imageRep releaseNow] or something. I suspect that just calling 'release' on the autoreleased memory would be a Bad Idea.
Any suggestions very welcome!
Cheers
Jonny_______________________________________________
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