TOC | PREV | NEXT

Problem: Too many releases on an object or accessing a freed object.

Solution:
Really read the "Debugging Tips" in the conversion guide. Then, learn how to use "
oh" (I think it should have been called "duh").
      Before debugging your app, set this environment variable:
      
      setenv NSZombieEnabled YES
      
      Then, load gdb, and set a breakpoint in main(), and run.
      When it breaks,
      
      call [NSAutoreleasePool enableDoubleReleaseCheck:YES]
      break _NSAutoreleaseFreedObject
      
      Note, that you may need a line in your main() which creates a new NSAutoreleasePool so that these symbols are defined .
      
void main(int argc, char *argv[]) {
      NSAutoreleasePool *pool;

      pool = [[NSAutoreleasePool alloc] init];
      
// SET NSAutoreleasePool Stuff here!!!
// Function "_NSAutoreleaseFreedObject" not defined until this point.

      [AppTextArt sharedApplication];
      if ([NSBundle loadNibNamed: @"Create" owner: NSApp]) {
       [pool release];
       [NSApp run];
       [NSApp release];
       exit(0);
      }
      else NSLog(@"Unable to load nib file:Create, exiting");

      [NSApp release];
      [pool release];

      exit(1);
}

      While broken in main(), in another terminal run "ps -auxw" to find the process id (PID) of newly started app. Then type:
      
      oh <PID> start
      
      Now you will find all the times you either send a message to something that has been freed or release something too many times. When the program complains that address
0xNNNN has already been freed, you can type in your other terminal window:
      
      oh <PID> 0xNNNN
      
      and it will print a backtrace of how that object was created and released.

      

TOC | PREV | NEXT
Match: Format:
Search:
Created by Stone Design's Create on 6/2/1997