Silly ARC question - explanation requested

2014-06-04 Thread Alex Zavatone
I was just reviewing a team member's code on iOS 7 for reading the CVPixelBuffer from a video frame, storing it in a UIImage and converting to grayscale. Was testing against 720p video in the iPad and was pretty surprised to see memory leak faster than I've ever seen before, but only after

Re: Silly ARC question - explanation requested

2014-06-04 Thread Quincey Morris
On Jun 4, 2014, at 12:24 , Alex Zavatone z...@mac.com wrote: His response was Well, I was able to autorelease any offending bits within the loop without a problem, what's the big deal? I think the deeper problem is that a while loop of this kind in an asynchronously executed block is a bit

Re: Silly ARC question - explanation requested

2014-06-04 Thread Ken Thomases
On Jun 4, 2014, at 2:24 PM, Alex Zavatone wrote: As it turned out, my coworker had created a dispatch_async thread to start processing the video and within it, started at a framecount of 0, incremented it within a while(true) loop and grabbed the frame every time there was a new

Re: Silly ARC question - explanation requested

2014-06-04 Thread Alex Zavatone
On Jun 4, 2014, at 4:07 PM, Ken Thomases wrote: On Jun 4, 2014, at 2:24 PM, Alex Zavatone wrote: As it turned out, my coworker had created a dispatch_async thread to start processing the video and within it, started at a framecount of 0, incremented it within a while(true) loop and

Re: Silly ARC question - explanation requested

2014-06-04 Thread Alex Zavatone
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

Re: Silly ARC question - explanation requested

2014-06-04 Thread Ken Thomases
On Jun 4, 2014, at 4:26 PM, Alex Zavatone wrote: On Jun 4, 2014, at 4:07 PM, Ken Thomases wrote: You have a misconception as illustrated in the above quotes. I think you think of ARC as a garbage collector that needs idle time or for execution to return to the frameworks in order to

Re: Silly ARC question - explanation requested

2014-06-04 Thread Quincey Morris
On Jun 4, 2014, at 14:45 , Alex Zavatone z...@mac.com wrote: But I need to come up with an explanation of explain why that is a bad idea and why it smells It smells because a computationally intensive while loop will stall the dispatch queue that’s stuck on it. If you’re programming with

Re: Silly ARC question - explanation requested

2014-06-04 Thread Alex Zavatone
Sweet. Thanks guys. That's exactly what I needed to frame why this is bad to our former dot net guy. Cheers. On Jun 4, 2014, at 6:02 PM, Quincey Morris wrote: On Jun 4, 2014, at 14:45 , Alex Zavatone z...@mac.com wrote: But I need to come up with an explanation of explain why that is a