__NSCFNumber autoreleased error

When I run my Service app built with 2015 r2.1 under Mac OS X 10.7 I get a bunch of:

objc[320]: Object 0x115fda0 of class __NSCFNumber autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug

… messages in the terminal window… and a few similar errors with “__NSCFDictionary” instead of “__NSCFNumber”.

The app still seems to run OK but I have not tested it entirely. I do not get these errors when running under 10.10.

Any idea what the problem is?

Thanks,
Jim

install a NSAutoreleasePool.

e.g. in Thread Run event something like:

dim n as new NSAutoReleasePoolMBS

(with using MBS Plugins)

Autorelease pools were introduced with OS X 10.7, if I remember correctly. Looks like there wasn’t always one available under 10.7 like it is today where you usually can rely on a default pool – I think that explains the difference in behavior you encounter.

Those pools existed in OS X 10.0 already.

It’s just that OS X provides one on the main thread by default.
On other threads, you need to install one yourself.

[quote=201111:@James Meyer]When I run my Service app built with 2015 r2.1 under Mac OS X 10.7 I get a bunch of:

objc[320]: Object 0x115fda0 of class __NSCFNumber autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug

… messages in the terminal window… and a few similar errors with “__NSCFDictionary” instead of “__NSCFNumber”.

The app still seems to run OK but I have not tested it entirely. I do not get these errors when running under 10.10.

Any idea what the problem is?

Thanks,
Jim[/quote]

Is this on the main thread of a service application or a secondary thread?

I assume on the main thread… The app does have a thread but it does not run when the app is launched… and the messages in the terminal window appear on launch.

Please file a bug report.

It seems Christian has already filed a report: 38154… There is also some “fixed” reports for older version of Xojo: 26764, 16881 & Joe’s 6874.

Is this going to be a problem for my app? Is it going to leak? If so, is there a work-around?

Do you use any declares into the Objective-C Runtime?

I do have some declares into Carbon.framework but nothing that is called in the Run event…

[quote=201117:@Christian Schmitz]install a NSAutoreleasePool.

e.g. in Thread Run event something like:

dim n as new NSAutoReleasePoolMBS[/quote]

This did not solve the problem…

If you create any of these objects with class methods, you could instead create them with alloc/init. A class method like

+ (NSNumber *)numberWithInt:(int)value

returns an autoreleased instance, while one created with alloc/init does not:

- (NSNumber *)initWithInt:(int)value