Yes, wierd. But predictable, considering you call [ pool release ] in
the init function. Do not release the autorelease pool! It needs to
exist for the duration of the program (the allocation of a new pool
affects all code in the current thread). The autorelease pool is where
objects go to decrement their retain count at some unknown time in the
future, usually every time through the event loop (so you can return a
"released" object from a method, which the Cocoa API does almost
everywhere). There must always be an autorelease pool in place for the
current thread if it is calling the Cocoa API (which SDL does).
However, you do need to periodically release the autorelease pool to
avoid a (potential) slow memory leak. To do this, store the pool
instance in a global variable. If you ever release the autorelease
pool, don’t forget to recreate it immediately.
Hope this helps,
DarrellOn Thursday, April 3, 2003, at 03:02 PM, sdl-request at libsdl.org wrote:
Write Java app that uses SDL through JNI.
Successfully compiled .jnilib for OS X
What I think I need
Need minimal OS X specific code to open a window, etc. in Main.c