Re: Memory not being released in a timely manner
Re: Memory not being released in a timely manner
- Subject: Re: Memory not being released in a timely manner
- From: Jonathan Taylor <email@hidden>
- Date: Thu, 06 Jun 2013 12:41:56 +0100
Thankyou all for your replies. A few responses -
On 4 Jun 2013, at 16:30, Jeff Johnson wrote:
> We've run into this issue in a number of apps. As a workaround, we add a timer to the main thread and have it fire periodically. The timer's action method does the following:
Thanks again! I've implemented your code and that has "fixed" my problem - great news.
On 4 Jun 2013, at 18:33, Jens Alfke wrote:
> I don’t know if ObjectAlloc is supported anymore; you should be using Instruments.
>
> It’s been a long time since I used that app, so I don’t know if it reports all heap allocations or just Obj-C objects. The problem is that a small object (like an NSImageRep) can be hanging onto huge memory buffers for pixels.
Apologies, I meant the Allocations tool within Instruments. [Incidentally, in my install ObjectAlloc just launches Instruments/Allocations]
As far as I can see, the Allocations tool does not report memory that is pending release from an autorelease pool. It would be interesting to know if there was a way of monitoring that. Re your suggestion about wrapping code with my own autorelease pools, I have done so but I am pretty sure the movie generation APIs that I am using launch their own threads, ones that I don't have control over. Without being able to see exactly what allocations are still pending release, I can't be sure, but I am as certain as I can be that that's where the memory-pending-autorelease must be accumulating.
>> The problem seems to be that, even though ObjectAlloc thinks the memory has been released, it is not actually being properly freed up until some time later. The memory usage as reported in Activity Monitor climbs higher and higher until, if left unattended, there is apparently no more memory available.
>
> There are a lot of different numbers measuring different kinds of memory usage, and not all of them are relevant to this. What specific value in Activity Monitor are you talking about? The most relevant one is Private Mem (RPRVT).
Yep, that's the one. (I was trying to keep my original email reasonably concise!)
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