Re: blocks and autorelease weirdness

2010-04-19 Thread Ken Ferry
On Mon, Apr 19, 2010 at 3:09 AM, Henk Kampman wrote: > > On 19 apr 2010, at 11:41, Jean-Daniel Dupas wrote: > > > > > > > Le 19 avr. 2010 à 11:35, Henk Kampman a écrit : > > > >> Have a look at the following code > >> > >> -(void) test > >> { > >> testString = NULL; > >> > >> dispatch_as

Re: blocks and autorelease weirdness

2010-04-19 Thread Julien Jalon
And of course, I need some rest: On Mon, Apr 19, 2010 at 12:38 PM, Julien Jalon wrote: > I have to add that *you can't assume* using dispatch_async on main queue > within an NSApp will automatically drain the autorelease pool. > > AppKit drains the autorelease pool upon NSEvents dispatch. > > >

Re: blocks and autorelease weirdness

2010-04-19 Thread Julien Jalon
I have to add that using dispatch_async on main queue within an NSApp will automatically drain the autorelease pool. AppKit drains the autorelease pool upon NSEvents dispatch. On Mon, Apr 19, 2010 at 12:36 PM, Julien Jalon wrote: > I don't see anything wrong with the output being 1/2: > > -(voi

Re: blocks and autorelease weirdness

2010-04-19 Thread Julien Jalon
I don't see anything wrong with the output being 1/2: -(void) test { testString = NULL; dispatch_async(dispatch_get_global_queue(0, 0), ^{ dispatch_async(dispatch_get_main_queue(), ^{ NSString* aString = [[NSMutableString alloc] init];* // reta

Re: blocks and autorelease weirdness

2010-04-19 Thread Henk Kampman
On 19 apr 2010, at 11:41, Jean-Daniel Dupas wrote: > > > Le 19 avr. 2010 à 11:35, Henk Kampman a écrit : > >> Have a look at the following code >> >> -(void) test >> { >> testString = NULL; >> >> dispatch_async(dispatch_get_global_queue(0, 0), ^{ >> dispatch_async

Re: blocks and autorelease weirdness

2010-04-19 Thread Jean-Daniel Dupas
Le 19 avr. 2010 à 11:35, Henk Kampman a écrit : > Have a look at the following code > > -(void) test > { > testString = NULL; > > dispatch_async(dispatch_get_global_queue(0, 0), ^{ > dispatch_async(dispatch_get_main_queue(), ^{ > >

blocks and autorelease weirdness

2010-04-19 Thread Henk Kampman
Have a look at the following code -(void) test { testString = NULL; dispatch_async(dispatch_get_global_queue(0, 0), ^{ dispatch_async(dispatch_get_main_queue(), ^{ NSString* aString = [[NSMutableString alloc]