Xcode Linker错误:无法分配区域

时间:2011-09-14 11:27:46

标签: xcode4 linker

我想在iPad2上运行一个应用程序,但在链接时出现了这个错误:

collect2: ld terminated with signal 6 [Abort trap]
ld(69392) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
terminate called after throwing an instance of 'std::bad_alloc'
what():  std::bad_alloc

我不知道这个错误的原因是什么。它看起来像分配16777216字节(16MB),iPad2应该处理它!

1 个答案:

答案 0 :(得分:1)

你确定在链接时遇到了错误,并且它没有成功链接,安装并开始运行,那么是否收到错误?

你遇到的错误是因为malloc无法分配另一个16M的块,而这几乎可以肯定是因为你有疯狂的内存碎片(可能,但不常见)或内存泄漏(很常见!)

从链接器/ XCode工具中看到这种情况会很奇怪(除非你正在运行betaware,在这种情况下谁知道?!)你的应用程序更有可能。