Re: Autoreleased Data In Cocoa

2011-05-31 Thread Matt Patenaude
The Cocoa-created autorelease pool is automatically drained at an unspecified time, typically every few iterations of the run loops. You can trust it to do the right thing. -Matt Sent from my iPhone On May 31, 2011, at 8:32 AM, Bing Li wrote: > Dear Nick and all, > > Thanks so much for your

Re: Autoreleased Data In Cocoa

2011-05-31 Thread Nick Zitzmann
On May 31, 2011, at 9:32 AM, Bing Li wrote: > But I still have a question. If the autoreleased data will keep alive until > the pool is drained, what if the data is autoreleased in a Cocoa auto-created > pool? It will keep alive unless the process is shutdown? No. The framework makes and drain

Re: Autoreleased Data In Cocoa

2011-05-31 Thread Bing Li
Dear Nick and all, Thanks so much for your reply! I am still a new Cocoa developer so that I need to improve during the programming procedure. Now I modify the code and it works fine. The code is as follows. But I still have a question. If the autoreleased data will keep alive until the pool is

Re: Autoreleased Data In Cocoa

2011-05-30 Thread Nick Zitzmann
On May 30, 2011, at 8:15 PM, Bing Li wrote: > - (NSString *) receiveMessage > { >NSMutableString *receivedString; >NSString *message; >NSString *newReceivedString; >[isConnectedLock lock]; >@try >{ >if (isConnected) >