memory leak using CFBundleCopyResourceURL
Instruments tells me, that I'm leaking memory with the following lines of code
CFBundleRef mainBundle = CFBundleGetMainBundle ();
CFStringRef aString =CFStringCreateWithFormat(NULL, NULL, CFSTR("%i"),aNumber); 开发者_开发技巧
sound= CFBundleCopyResourceURL (mainBundle, aString, CFSTR ("aiff"), NULL);
CFRelease(aString);
I do release sound - which is of course a CFURLRef - in the dealloc of this class (which by the way is a subclass of UIView) using CFRelease.
The culprits seem to be a NSURL and a NSCFString.
But what else can I do apart from releasing sound and aString?
Use breakpoints to interact with the variable in question, that way you will likely solve your problem.
精彩评论