“自动释放类NSCFString的对象0x84be00,没有适当的池-只是泄漏". -但在应用程序的第一行! [英] "Object 0x84be00 of class NSCFString autoreleased with no pool in place - just leaking" - but on the first line of the app!

查看:79
本文介绍了“自动释放类NSCFString的对象0x84be00,没有适当的池-只是泄漏". -但在应用程序的第一行!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的iPhone应用程序中,在根本没有调用任何代码之前,在应用程序的开头,控制台中出现了三个奇怪的警告:

In my iPhone app, I am getting three strange warnings in the console at the very beginning of the app, before any code at all has been called:

*** __NSAutoreleaseNoPool(): Object 0x84be00 of class NSCFString autoreleased with no pool in place - just leaking
*** __NSAutoreleaseNoPool(): Object 0x84b000 of class NSCFString autoreleased with no pool in place - just leaking
*** __NSAutoreleaseNoPool(): Object 0x849c00 of class NSCFString autoreleased with no pool in place - just leaking

我在许多地方都使用MBProgressHUD来显示进度指示器,这是该问题的其他一些讨论所指出的,因为它在显示进度指示器时会抛出新的线程.但是最奇怪的是,这些似乎在我的main()函数开始之前就被抛出了:

I use MBProgressHUD in a number of places to show progress indicators, which is what some of the other discussions of this problem have pointed to because it throws a new thread when displaying the progress indicator. But the strangest thing is that these seem to be thrown before even the beginning of my main() function:

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

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

当我在第一个NSAutoreleasePool的代码中放置断点时,甚至在该行运行之前,我都会收到此警告.据推测,在此之前我没有运行自己的任何代码,可能会导致该错误?

When I put a breakpoint in my code on the very first NSAutoreleasePool, before that line even runs I get this warning. What could be causing the error when, supposedly, I am not running any of my own code before this point?

推荐答案

您可能在main()之前的某个地方运行了构造函数,从而触发了此问题.您要链接到哪些库和/或正在使用任何__attribute__指令?

You likely have a constructor somewhere that is running before main() that is triggering this problem. What libraries are you linking against and/or are you using any __attribute__ directives?

Herp.

意识到一些明显的事情.由于对象泄漏,它们仍然存在.在main()上设置一个断点,然后在GDB提示符下键入po 0x84be00(仅将0x84be00替换为泄漏的字符串之一的地址).

Realized something obvious. Since the objects are leaked, they still exist. Set a breakpoint on main() and then, at the GDB prompt, type po 0x84be00 (only replace 0x84be00 with the address of one of the strings that was leaked).

这将向您显示该字符串的内容,并为您提供一个很好的线索,了解原因是什么.

That'll show you the contents of that string and give you a very good clue as to what the cause is.

Derp.

__NSAutoreleaseNoPool上设置一个断点,并查看回溯向您显示的内容.

Set a breakpoint on __NSAutoreleaseNoPool and see what the backtraces show you.

我今天失败了(只是显而易见,因为我走了这条路18273.14万次).

I fail at the obvious today (only obvious because I've been down this road 18.27314 million times).

这篇关于“自动释放类NSCFString的对象0x84be00,没有适当的池-只是泄漏". -但在应用程序的第一行!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆