# NSAutoreleaseNoPool / leaks in SDL OS X

**URL:** <https://discourse.libsdl.org/t/nsautoreleasenopool-leaks-in-sdl-os-x/10634>\
**Category:** SDL Development\
**Created:** [May 6, 2004, 12:28am UTC](https://discourse.libsdl.org/t/nsautoreleasenopool-leaks-in-sdl-os-x/10634 "2004-05-06T00:28:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Wing](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/e/ea5d25/32.png) [@Eric\_Wing](https://discourse.libsdl.org/u/Eric_Wing)\
**Post date:** [May 6, 2004, 12:28am UTC](https://discourse.libsdl.org/t/nsautoreleasenopool-leaks-in-sdl-os-x/10634/1 "2004-05-06T00:28:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Eric\_Wing](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/e/ea5d25/32.png) [@Eric\_Wing](https://discourse.libsdl.org/u/Eric_Wing)\
**Post date:** [May 6, 2004, 10:14am UTC](https://discourse.libsdl.org/t/nsautoreleasenopool-leaks-in-sdl-os-x/10634/2 "2004-05-06T10:14:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![slouken](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/s/ec9cab/32.png) [@slouken](https://discourse.libsdl.org/u/slouken)\
**Post date:** [May 16, 2004, 10:46pm UTC](https://discourse.libsdl.org/t/nsautoreleasenopool-leaks-in-sdl-os-x/10634/3 "2004-05-16T22:46:24Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![Max\_Horn](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/max_horn/32/2716_2.png) [@Max\_Horn](https://discourse.libsdl.org/u/Max_Horn)\
**Post date:** [May 17, 2004, 9:22pm UTC](https://discourse.libsdl.org/t/nsautoreleasenopool-leaks-in-sdl-os-x/10634/4 "2004-05-17T21:22:37Z")

</div>

> > 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:

---

<div class="post-metadata">

**Author:** ![Eric\_Wing](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/e/ea5d25/32.png) [@Eric\_Wing](https://discourse.libsdl.org/u/Eric_Wing)\
**Post date:** [May 18, 2004, 11:09am UTC](https://discourse.libsdl.org/t/nsautoreleasenopool-leaks-in-sdl-os-x/10634/5 "2004-05-18T11:09:42Z")

</div>

> > 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
