Re: Memory management about async object

2011-02-07 Thread ico
Hi All, What if the handler retain itself, and then will perform some NSURLConnection tasks, that will async download some data, and receive some messages as a delegate by implementing connection:didReceiveResponse connection:didReceiveData connection:didFailWithError connection:didFinishLoading

Re: Memory management about async object

2011-01-01 Thread Steve Sisak
There's some good information on this in TechNote 2009 Also, here is some sample code you might find very helpful: as it does almost what you're descr

Re: Memory management about async object

2011-01-01 Thread Andreas Grosam
On Dec 29, 2010, at 5:54 PM, James Bucanek wrote: > - (void) loadData { >DataHandler *myHandler = [[DataHandler alloc] init]; >// set this view controller itself as a delegate, when the data loading > finished, myHandler will call its callback method >myHandler.delegate = self; >[

Re: Memory management about async object

2010-12-29 Thread James Bucanek
Answering myself... James Bucanek wrote (Tuesday, December 28, 2010 8:36 AM -0700): ico wrote (Tuesday, December 28, 2010 11:18 PM +0800): My question is, when should I release the myHandler? Should I release it in the myCallback,

Re: Memory management about async object

2010-12-28 Thread James Bucanek
ico wrote (Tuesday, December 28, 2010 11:18 PM +0800): My question is, when should I release the myHandler? Should I release it in the myCallback, but after myCallback method finishes, it will return point 1 indicated as above, and that myHandler instance is just rele

Re: Memory management about async object

2010-12-28 Thread ico
Hi Stephen, Thanks for your reply, so there is no any perfect solution for this kind of problem? And can you give me a specific example to demonstrate why why it is not safe to release these async objects inside a callback method and why not safe to autorelease it? Thanks. On Tue, Dec 28, 2010 at

Re: Memory management about async object

2010-12-28 Thread Stephen J. Butler
On Tue, Dec 28, 2010 at 12:18 AM, ico wrote: > My question is, when should I release the myHandler? Should I release it in > the myCallback, but after > myCallback method finishes, it will return point 1 indicated as above, and > that myHandler instance is just > released. > > Or there is a better