error due to double_free

Discussion in 'Mac Programming' started by satyam90, Feb 1, 2008.

  1. satyam90
    Expand Collapse
    macrumors regular

    satyam90

    Joined:
    Jul 30, 2007
    Location:
    Bangalore, India
    #1
    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.
     
  2. iSee
    Expand Collapse
    macrumors 68040

    iSee

    Joined:
    Oct 25, 2004
    #2
    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
     
  3. satyam90
    Expand Collapse
    thread starter macrumors regular

    satyam90

    Joined:
    Jul 30, 2007
    Location:
    Bangalore, India
    #3
    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.
     
  4. kainjow
    Expand Collapse
    Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #4
    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.
     
  5. satyam90
    Expand Collapse
    thread starter macrumors regular

    satyam90

    Joined:
    Jul 30, 2007
    Location:
    Bangalore, India
    #5
    Yes, But how to find out from which source code file it is being generated?
     
  6. kainjow
    Expand Collapse
    Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #6
    And that is where iSee's post comes in :)
     

Share This Page