Re: Runtime error: _NSAutoreleaseNoPool
Re: Runtime error: _NSAutoreleaseNoPool
- Subject: Re: Runtime error: _NSAutoreleaseNoPool
- From: Graham <email@hidden>
- Date: Fri, 13 May 2005 18:27:08 -0400
Reading the online docs (yes, I should have done this before emailing the group - but hey, I'm lazy) I discovered the issue. I've been using all kinds of Cocoa calls from my Java threads without issue, but this method:
NSPropertyListSerialization.propertyListFromData()
causes the warnings I was getting. The documentation explains the simple fix as follows:
NSAutoreleasePool An autorelease pool is used to manage Foundation’s autorelease mechanism for Objective-C objects. NSAutoreleasePool Provides Java applications access to autorelease pools. Typically it is not necessary for Java applications to use NSAutoreleasePools since Java manages garbage collection. However, some situations require an autorelease pool; for instance, if you start off a thread that calls Cocoa, there won’t be a top-level pool. You know you need an autorelease pool when you see “no pool in place - just leaking” warnings coming from your Cocoa Java application. Just wrap pools around the places where you have top-level Java threads calling into Cocoa. Use code like the following to accomplish this task:
int myPool = NSAutoreleasePool.push(); |
|
|
| // Your code here |
|
|
| NSAutoreleasePool.pop(myPool); |
|
On May 13, 2005, at 3:40 PM, Graham wrote: Hi,
I just implemented my file caching (thanks for all the help with that), and I notice I get the following two errors in the console when my app runs. What do these errors mean, since I am using Java?
Thanks
Graham
2005-05-13 15:36:43.796 iPictr[3118] *** _NSAutoreleaseNoPool(): Object 0x9262470 of class NSCFDictionary autoreleased with no pool in place - just leaking 2005-05-13 15:36:43.796 iPictr[3118] *** _NSAutoreleaseNoPool(): Object 0x92546a0 of class NSCFData autoreleased with no pool in place - just leaking
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden