I'm looking at someone else's code, but it appears to RELEASE object VIDEO but then continue to use it.
Now from my understanding of Object Oriented Programming languages, once it's released, it should be dealloc'd from memory...
I can't see how it has any references...but I'm assuming that's the reason it's OK. Seems like a strange thing to do, (Release it when you haven't finished with it, why not use autorelease for example).
self.video = [[VideoFrameExtractor alloc] initWithVideo:[Utilities bundlePath:@"sophie.mov"]];
[video release];
// set output image size
video.outputWidth = 426;
video.outputHeight = 320;
it's equivalent to:
self.video = [[[VideoFrameExtractor alloc] initWithVideo:[Utilities bundlePath:@"sophie.mov"]] autorelease];
(assuming the video is retained by self)
there's a small performance boost by avoiding autorelease pools where possible, as well as it helps localize errors in your code regarding ref counting. soo... assuming the property is retain or copy, then self should hold exactly one reference - which is perfect.
hope that helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With