Re: Silly ARC question - explanation requested
Re: Silly ARC question - explanation requested
- Subject: Re: Silly ARC question - explanation requested
- From: Alex Zavatone <email@hidden>
- Date: Wed, 04 Jun 2014 17:45:58 -0400
On Jun 4, 2014, at 4:02 PM, Quincey Morris wrote:
> I think the deeper problem is that a while loop of this kind in an asynchronously executed block is a bit of a code smell.
Exactly.
But I need to come up with an explanation of explain why that is a bad idea and why it smells. I know it smells, but he can't see why it smells bad in Cocoa.
Ohh, I like the serial queue approach very much. Sweet.
> This is not really an ARC-related pitfall, but a GCD-related one, IMO.
Yeah, that is what I am trying to determine. Is it that the while loop is causing problems, or is it simply that since he's trying to process the whole video of arbitrary length and dimensions within ONE dispatch_asynch that's the root of the issue?
Yeah, I'd expect all the memory to be released after the thread/bock completes and memory would be fine if the iDevice had 10 GB of RAM, or if the video was very short.
And memory does get released if I break out of the while loop early which is exactly as expected. I was expecting that memory would get released if I voided the offending UIImage, but it doesn't and even as the loop iterates, the local UIImage instance piles up in memory. I'll be damned if I know where there's a reference to it lying around and since I'd set it to nil, I was wondering why ARC didn't take effect exactly when I did that, but instead waits until after the whole while loop and thread/block.
Cheers and thanks man
_______________________________________________
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