开发者

Getting Error : malloc: *** error for object 0xc79e430: double free *** set a breakpoint in malloc_error_break to debug

开发者 https://www.devze.com 2023-03-13 04:30 出处:网络
I am getting this error in my iPhone app. Error : DemoApp(1874,0xb024f000) malloc: * e开发者_StackOverflowrror for object 0xc79e430: double free

I am getting this error in my iPhone app.

Error : DemoApp(1874,0xb024f000) malloc: * e开发者_StackOverflowrror for object 0xc79e430: double free * set a breakpoint in malloc_error_break to debug

In that View I am using JSON code and after parsing data displayed accordingly but after few minutes application gets crashed. Can any one help me. Thank your


For any EXC_BAD_ACCESS or double free errors, you are usually trying to send a message to a released object. The BEST way to track these down is use NSZombieEnabled.

This works by never actually releasing an object, but by wrapping it up as a "zombie" and setting a flag inside it that says it normally would have been released. This way, if you try to access it again, it still know what it was before you made the error, and with this little bit of information, you can usually backtrack to see what the issue was.

It especially helps in background threads when the Debugger sometimes craps out on any useful information.

VERY IMPORTANT TO NOTE however, is that you need to 100% make sure this is only in your debug code and not your distribution code. Because nothing is ever release, your app will leak and leak and leak. To remind me to do this, I put this log in my appdelegate:

if(getenv("NSZombieEnabled") || getenv("NSAutoreleaseFreedObjectCheckEnabled"))
  NSLog(@"NSZombieEnabled/NSAutoreleaseFreedObjectCheckEnabled enabled!");


It's just an memory release issues. By mistake I have release the memory before and after that I am trying to access the values of that variable that's why I am getting error. Thanks

0

精彩评论

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