malloc: *** error: incorrect checksum for freed object - object was probably modified after being freed

前端 未结 4 1124
悲&欢浪女
悲&欢浪女 2020-11-30 05:19

I have a big problem with my iOS App: it crashes sometimes without detailed debug error. The stack trace is empty. These are the only two lines in the stack trace:

相关标签:
4条回答
  • 2020-11-30 05:52

    hi guys i have found this solution if you are using nib or xib interface and you facing this problem when you want to push a viewcontroller object then some time this error will occur and your app will be crash (specially error in iPad) Here is the solution:

    // Format like this

    UINavigationController *nav=[[UINavigationController      alloc]initWithRootViewController:yourViewControllerObj];
    
    [self.navigationController  presentViewController:nav animated:true completion:nil];
    

    Don't try to push in this condition.

    0 讨论(0)
  • 2020-11-30 05:53

    If you have this problem. go to: product->scheme->diagnosis-> then enable mollic gaurd edge and zombie object then close then go product->stop then again product-build and run. best ofluck

    0 讨论(0)
  • 2020-11-30 06:05

    Since you're in the debugger, you should look at the memory location 0x208a7614 and see what's there. The data in memory may be helpful in figuring out what's going wrong.

    What's happening is one of the following:

    1. you are freeing an object twice,

    2. you are freeing a pointer that was never allocated

    3. you are writing through an invalid pointer which previously pointed to an object which was already freed

    Since the stack trace is coming up empty, it might be useful to add some debugging log statements to your code at various places to see if you can narrow down where in the code the problem lies. Using the memory tools in Instruments might also help. You could try turning on NSZombies, but this looks like a C allocation problem and not an Objective-C one.

    Also, is anything else written to the console before the crash? If so, it may point you to where the problem is coming from.

    0 讨论(0)
  • 2020-11-30 06:16

    To find the source of the problem, in Xcode go to Product > Scheme > Edit Scheme, and under Diagnostics tab enable all the Malloc settings and Guard Malloc.

    With that, run your application again, and Xcode will stop at the line causing the problem.

    Scheme definition

    0 讨论(0)
提交回复
热议问题