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: Fri, 07 Jun 2013 17:44:52 +0100
> It smells like you're doing a lot of processing with temporary objects, in a loop, without bracketing the loop body in @autoreleasepool{}, but I remember you saying you're not.
Oh dear. Oh dear.
You are right. I know this is what everybody has been telling me all along. I have a tiny one-line GCD block that is re-posted back onto the main event loop (for thread safety reasons), which I had overlooked. It was setting off a chain reaction of binding notifications etc that resulted in the image as displayed in the GUI being updated. An autoreleased image buffer involved in this wasn't being caught by an explicit pool, and so was falling foul of the problem described by Jeff Johnson whereby autoreleased objects weren't being cleaned up in a timely manner.
So, wrapping that single line of code in an autorelease pool has fixed it. I'm so sorry for taxing everyone's patience on this one!
Your suggestion of the VM Tracker instrument (which I had not spotted before) did bring up some interesting results though. These autoreleased image buffers that were causing the problem are definitely NOT reported at all by Allocations ("live" bytes stays stable at 250MB), but they do show up under VM Tracker as "CG image" and "CG raster data" - although I don't think there's a way of getting any further details about the buffers they provide the backing for?
I do think it's interesting though (and a bit worrying) that the only way I could pinpoint the actual problem was by reading through the relevant bits of my code over and over - I wasn't able to glean any info from Instruments that really narrowed things down, other than to confirm that there were definitely image buffers accumulating somewhere.
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