Re: Why Wasn't Memory Collected?
Re: Why Wasn't Memory Collected?
- Subject: Re: Why Wasn't Memory Collected?
- From: Nick Zitzmann <email@hidden>
- Date: Sat, 11 Jun 2011 23:45:06 -0600
On Jun 11, 2011, at 11:39 PM, Bing Li wrote:
> I add a sub-autoreleasepool immediately outside the method that created XML. Once if the XML is sent, the memory should be released, right? Now the amount of memory consumed is very limited, almost no change in Activity Monitor.
>
> So I guess sub-autoreleasepool is important. We should not depend on the most high level autoreleasepool to collect memory. Am I right?
No, you can depend on it to collect memory, but you need to run your own pools if you need to create and get rid of large amounts of temporary objects. And you're going to need to use Instruments' object alloc instrument to figure out where your code is creating large amounts of temporary objects. Do not use Activity Monitor as a profiling tool.
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
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