PDA

View Full Version : error due to double_free




satyam90
Feb 1, 2008, 04:44 AM
HI,
I am using Cocoa framework with Obj C.
I am getting following error while closing a window:
iFolder 3(17493,0xa000d000) malloc: *** error for object 0x15d1c4b0: double free
iFolder 3(17493,0xa000d000) malloc: *** set a breakpoint in szone_error to debug

I am not able to find it out from which file and why it is being generated. Infact in all the functions related calling the window (due to which I am getting above error) and inside the code, I am not using "RELEASE" at all.



iSee
Feb 1, 2008, 08:29 AM
HI,
I am using Cocoa framework with Obj C.
I am getting following error while closing a window:
iFolder 3(17493,0xa000d000) malloc: *** error for object 0x15d1c4b0: double free
iFolder 3(17493,0xa000d000) malloc: *** set a breakpoint in szone_error to debug

I am not able to find it out from which file and why it is being generated. Infact in all the functions related calling the window (due to which I am getting above error) and inside the code, I am not using "RELEASE" at all.

Do what it says and set a breakpoint in szone_error. The breakpoint will be triggered on the extra call to free. When it's triggered, you'll probably be able to figure out what's wrong by examining the call stack to find out what code is triggering the extra free and thinking about how to avoid it.
When you hit the breakpoint you should be able to seeyou'll be able to look at the call stack and see what the root

satyam90
Feb 3, 2008, 09:16 PM
I am using XCode only to creating user interface. But I am using Makefiles for compiling. So, I cannot set the break point.
I will try to use GDB, what is the procedure to compile .m files for debugging purpose. For example, we need to add "-g" option in unix/linux with C/C++ files to make it useful for debugging.

kainjow
Feb 4, 2008, 11:23 AM
How are you not calling release? Are you calling autorelease? If you call autorelease or release twice on an object it will give you that error.

satyam90
Feb 4, 2008, 10:19 PM
Yes, But how to find out from which source code file it is being generated?

kainjow
Feb 5, 2008, 01:13 AM
Yes, But how to find out from which source code file it is being generated?

And that is where iSee's post comes in :)