代码之家  ›  专栏  ›  技术社区  ›  Nareshkumar

仅当启用mallocguard时,获取exc\u bad\u访问错误

  •  0
  • Nareshkumar  · 技术社区  · 15 年前

    我有一个iPhone应用程序在开发中,它可以正常工作时,Malloc后卫是没有启用。但是,当我尝试启用malloc守护程序时,在加载应用程序之后,我会遇到以下错误。

    #0  0x95f65684 in objc_msgSend ()
    

    #1 0x30506515 in NSPopAutoreleasePool ()

    #2 0x30901697 in _UIApplicationHandleEvent ()

    #3 0x32046375 in PurpleEventCallback ()

    #4 0x30245560 in CFRunLoopRunSpecific ()

    #5 0x30244628 in CFRunLoopRunInMode ()

    #6 0x308f930d in -[UIApplication _run] ()

    #7 0x309021ee in UIApplicationMain () 现在我的问题是,我无法调试它出错的确切位置。。尝试了malloc\u error\u break,但没有成功。 是malloc-guard根据分配自动释放一些对象吗??

    1 回复  |  直到 15 年前
        1
  •  0
  •   Stephen Darlington    15 年前

    你正在释放一些自动释放的内存。如果没有看到您的任何代码,很难说问题到底是什么,但它看起来是这样的:

    NSString* aVar = [NSString stringWithFormat:@"Hello %@", worldVariable];
    
    ...
    
    [aVar release];
    

    在运行循环的某个稍后点崩溃,自动释放池已“耗尽”