Reply To: Syphon JNI Binding

Home Forums Syphon Syphon Development – Developer Syphon JNI Binding Reply To: Syphon JNI Binding

#5098
vade
Keymaster

Hi!

scad = [[[SimpleClientAppDelegate alloc] init] autorelease];

You do not want to do this. This is releasing (deallocing) you object the next time the auto release pool is drained. You are telling the memory management system “mark this as being able to go away at any time in the future, at your leisure”. Thats not what you want. Having the auto-release pools how you have them is correct, that should be all you need for proper memory management in cocoa, assuming your objects are properly retained/released within the code.

Those “extra” auto-releases are going to remove objects out from under you without you knowing when, which is bad!

edit: this is to say, an auto-release pool facilitates the ‘auto release’ mechanism to work, so autorelease messages will *release* objects (auto release pools also handle other things, but just clarifying that you want to have the *pools* in place, but do not want to *auto-release* objects you want to stick around :).