开发者

Memory leaks in an iPhone app

I have the following memory leaks in m开发者_运维技巧y code. What does it mean? How can I fix this?

#import <UIKit/UIKit.h>

int main(int argc, char *argv[]) {

    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    **int retVal = UIApplicationMain(argc, argv, nil, nil);**
    [pool release];
    return retVal;
}

Thanks in Advance.


That code is from your main.m file. It seems odd that this part of your code would leak, if at all??

How did you find this leak?

Are you using the simulator or a real device?

If using the simulator you can sometimes have leaks that are not leaks at all, it is always better to test these kinds of things on a real device (which you have not specified). Double check all of your release, retains etc in your code. You might just spot something you have not released. (in xcode 4 use the assistant editor I find it better to spot these kinds of things alt+cmd+enter).

Your question otherwise is hard to answer, you might want to edit it with how you found it and in what environment.

Hope some of this helps

[EDIT] saw you tagged this with cocos2D (what version are you using of that?) there are some reported issues elsewhere on SO with memory leaks using older versions of cocos2D

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜