openFrameworks icon indicating copy to clipboard operation
openFrameworks copied to clipboard

ofCreateAlertDialog - leaking on os x

Open ofTheo opened this issue 15 years ago • 4 comments

2011-01-14 14:46:11.675 serialExample[91162:a0f] *** __NSAutoreleaseNoPool(): Object 0x3478e0 of class NSCFArray autoreleased with no pool in place - just leaking 2011-01-14 14:46:11.676 serialExample[91162:a0f] *** __NSAutoreleaseNoPool(): Object 0x347d00 of class NSPathStore2 autoreleased with no pool in place - just leaking 2011-01-14 14:46:11.676 serialExample[91162:a0f] *** __NSAutoreleaseNoPool(): Object 0x347d30 of class NSCFData autoreleased with no pool in place - just leaking 2011-01-14 14:46:11.677 serialExample[91162:a0f] *** __NSAutoreleaseNoPool(): Object 0xa03d2ae8 of class NSCFString autoreleased with no pool in place - just leaking 2011-01-14 14:46:11.678 serialExample[91162:a0f] *** __NSAutoreleaseNoPool(): Object 0x31dfd0 of class __NSArray0 autoreleased with no pool in place - just leaking 2011-01-14 14:46:11.679 serialExample[91162:a0f] *** __NSAutoreleaseNoPool(): Object 0x3199c0 of class NSCFNumber autoreleased with no pool in place - just leaking 2011-01-14 14:46:11.680 serialExample[91162:a0f] *** __NSAutoreleaseNoPool(): Object 0x347fa0 of class NSCFArray autoreleased with no pool in place - just leaking 2011-01-14 14:46:11.681 serialExample[91162:a0f] *** __NSAutoreleaseNoPool(): Object 0x3353f0 of class NSCFArray autoreleased with no pool in place - just leaking 2011-01-14 14:46:11.682 serialExample[91162:a0f] *** __NSAutoreleaseNoPool(): Object 0xa067344c of class NSCFString autoreleased with no pool in place - just leaking 2011-01-14 14:46:15.645 serialExample[91162:a0f] *** __NSAutoreleaseNoPool(): Object 0x1813ee0 of class NSCFArray autoreleased with no pool in place - just leaking 2011-01-14 14:46:15.650 serialExample[91162:a0f] *** __NSAutoreleaseNoPool(): Object 0x1826d60 of class NSCarbonWindow autoreleased with no pool in place - just leaking

ofTheo avatar Jan 14 '11 19:01 ofTheo

it doesn't seem like there's any way of creating an NSAutoreleasePool without Objective-C. so the only way to deal with this will be to put a little .m file with NSAutoreleasePool* pool = [[NSAutoreleasPool alloc] init] somewhere, and then later on [pool release]...

damian0815 avatar Jan 16 '11 04:01 damian0815

I have added a .m file and header to this branch that creates and releases a NSAutoreleasePool. The header is included in ofSystemUtil.cpp with extern 'C' {...}

It appears to resolve this issue. After the NSAutoreleasePool is created the warnings are not logged and the memory leaks are no longer reported by Instruments.

I have named the file osxUtil.h/m. Is there a more appropriate file name? Is /libs/openFramework/util/ an appropriate location for these files?

dallastaylor avatar Oct 24 '11 02:10 dallastaylor

this is closed. by https://github.com/openframeworks/openFrameworks/issues/792

ofTheo avatar Feb 25 '12 20:02 ofTheo

fyi, if you reference to issues and PRs on github, it's enough to write #792 - no need for pasting the whole URL. :-)

bilderbuchi avatar Feb 25 '12 20:02 bilderbuchi