NSAutoreleaseNoPool / leaks in SDL OS X

I just started noticing these runtime warnings when
running an SDL app:

2004-05-05 14:56:11.258 testgl[14654] ***
_NSAutoreleaseNoPool(): Object 0x50eef0 of class
NSCFString autoreleased with no pool in place - just
leaking
2004-05-05 14:56:11.260 testgl[14654] ***
_NSAutoreleaseNoPool(): Object 0x552cb0 of class
NSPathStore2 autoreleased with no pool in place - just
leaking
2004-05-05 14:56:11.260 testgl[14654] ***
_NSAutoreleaseNoPool(): Object 0x50eef0 of class
NSCFString autoreleased with no pool in place - just
leaking
2004-05-05 14:56:11.261 testgl[14654] ***
_NSAutoreleaseNoPool(): Object 0x555190 of class
NSPathStore2 autoreleased with no pool in place - just
leaking
2004-05-05 14:56:11.262 testgl[14654] ***
_NSAutoreleaseNoPool(): Object 0x50eef0 of class
NSCFString autoreleased with no pool in place - just
leaking
2004-05-05 14:56:11.263 testgl[14654] ***
_NSAutoreleaseNoPool(): Object 0x555200 of class
NSPathStore2 autoreleased with no pool in place - just
leaking

At first I thought it was something in my programs,
but I grabbed the SDL 1.2.7 source and built 2 of the
test programs (testgl, checkkeys) and I saw these same
errors.

It seems to happen at the very start of a program.
I’ve seen the actual timing of the message vary
somewhat, so it might be in another thread. Putting
printf’s and SDL_Delays in my code, I’ve seen the
message as early as the first line in main() which
makes me think it may be triggered in SDLmain.m.

A quick Google search says to put
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]
init]; at the beginning of main() and
[pool release];
just before main() returns, but it looks like
SDLmain.m already has this, so I don’t know what the
problem is.

I’ve never noticed this warning before in 1.2.6,
though I’m not absolutely sure it didn’t exist.

Any ideas on how to fix this?

Thanks,
Eric

Please disregard this. It seems that there was a
system update applied to the system and the system had
not yet been rebooted. After reboot, the problem seems
to have disappeared. Sorry for any trouble.

Thanks,
Eric

— Eric Wing wrote:> I just started noticing these runtime warnings when

running an SDL app:

2004-05-05 14:56:11.258 testgl[14654] ***
_NSAutoreleaseNoPool(): Object 0x50eef0 of class
NSCFString autoreleased with no pool in place - just
leaking
2004-05-05 14:56:11.260 testgl[14654] ***
_NSAutoreleaseNoPool(): Object 0x552cb0 of class
NSPathStore2 autoreleased with no pool in place -
just
leaking
2004-05-05 14:56:11.260 testgl[14654] ***
_NSAutoreleaseNoPool(): Object 0x50eef0 of class
NSCFString autoreleased with no pool in place - just
leaking
2004-05-05 14:56:11.261 testgl[14654] ***
_NSAutoreleaseNoPool(): Object 0x555190 of class
NSPathStore2 autoreleased with no pool in place -
just
leaking
2004-05-05 14:56:11.262 testgl[14654] ***
_NSAutoreleaseNoPool(): Object 0x50eef0 of class
NSCFString autoreleased with no pool in place - just
leaking
2004-05-05 14:56:11.263 testgl[14654] ***
_NSAutoreleaseNoPool(): Object 0x555200 of class
NSPathStore2 autoreleased with no pool in place -
just
leaking

At first I thought it was something in my programs,
but I grabbed the SDL 1.2.7 source and built 2 of
the
test programs (testgl, checkkeys) and I saw these
same
errors.

It seems to happen at the very start of a program.
I’ve seen the actual timing of the message vary
somewhat, so it might be in another thread. Putting
printf’s and SDL_Delays in my code, I’ve seen the
message as early as the first line in main() which
makes me think it may be triggered in SDLmain.m.

A quick Google search says to put
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]
init]; at the beginning of main() and
[pool release];
just before main() returns, but it looks like
SDLmain.m already has this, so I don’t know what the
problem is.

I’ve never noticed this warning before in 1.2.6,
though I’m not absolutely sure it didn’t exist.

Any ideas on how to fix this?

Thanks,
Eric

Hi all,
Did someone respond with a fix for this MacOS X problem, or did I
miss it?

I forwarded to the SDL Mac developers.

See ya!
-Sam Lantinga, Software Engineer, Blizzard Entertainment

Hi all,
Did someone respond with a fix for this MacOS X problem, or did I
miss it?

I forwarded to the SDL Mac developers.

I didn’t see the mail forwarded, but found a copy on the list archives.

Basically, what Eric describes sounds as if SDLmain.m / libSDLmain is
not being used, or maybe a very old version of it. I definitely can’t
reproduce the problems, neither with testgl nor with anything else. And
we do use a NSAutoreleasePool, FYI ;-).

Bye,

MaxAm 17.05.2004 um 00:46 schrieb Sam Lantinga:

Hi all,

Did someone respond with a fix for this MacOS
X problem, or did I

miss it?

Basically, what Eric describes sounds as if
SDLmain.m / libSDLmain is
not being used, or maybe a very old version of it. I
definitely can’t
reproduce the problems, neither with testgl nor with
anything else. And
we do use a NSAutoreleasePool, FYI ;-).

Sorry, this was a mistake on my part. I posted a
retraction about the situation less than a day after I
did the initial post. It seems that the problem was
caused by an OS X update that was applied to the
system I was working on, which wasn’t rebooted right
after. My guess is the Objective-C runtime was
modified. After the reboot, the problem disappeared.

-Eric