开发者

memory leak using CFBundleCopyResourceURL

开发者 https://www.devze.com 2023-04-03 13:37 出处:网络
Instruments tells me, that I\'m leaking memory with the following lines of code CFBundleRef mainBundle = CFBundleGetMainBundle ();

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消