Re: Strange "autoreleased with no pool in place" message
Re: Strange "autoreleased with no pool in place" message
- Subject: Re: Strange "autoreleased with no pool in place" message
- From: Alexander Bokovikov <email@hidden>
- Date: Sun, 18 Apr 2010 18:52:24 +0600
On 18.04.2010, at 1:59, Ken Thomases wrote:
Run > Manage Breakpoints > Add Symbolic Breakpoint. Type the name
of the function to break on.
In general, you should familiarize yourself with the Xcode Debugging
Guide:
http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/XcodeDebugging/
Thank you, though I've found the reason. A friend of mine shared this
code snippet with me:
#ifdef DEBUG
#define NSLog( s, ... ) NSLog( @"<%s : (%d)> %@",__FUNCTION__,
__LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )
#else
#define NSLog( s, ... )
#endif
This macro is helpful when it is in correct hands :) I didn't take it
into account that such redefined NSLog can't be used without a
NSAutoReleasePool, being previously initialized. Usual NSLog can be
used wherever you wish unless it is not using autoreleased objects.
For example, NSLog(@"Hello"); can be inserted wherever you wish, right?
I've removed NSLog call from one improper location, and the problem
has disappeared. What is interesting, this error didn't lead to crash
in 10.5+, but leads to crash in 10.4.
Most likely you started an NSThread without putting an autorelease
pool in the thread’s main function, or you got a callback on some
thread and are making Cocoa calls on it without wrapping your
callback in an autorelease pool.
Start NSThread even BEFORE main() ? Is it possible?
It is possible, with something like +load. It's also possible log
lines are somehow out of order. In any case, there's no reason to
speculate. The debugger can show you exactly where/when this is
happening.
As for threads, it's definitely not my case. all my threads are
initialized in FreePascal back-end stuff, because FPC doesn't support
Cocoa threads for some reason. Of course I'm using NSAutoReleasePool
in all Cocoa methods, called from FPC thread procedures. Fortunately
this part of my project works OK.
Thanks.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden