gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DO and "leaked" connection object


From: Maxthon Chan
Subject: Re: DO and "leaked" connection object
Date: Tue, 05 Feb 2013 17:31:34 +0800

Just an idea, will ARC work?

在 2013-2-5,下午5:20,Riccardo Mottola <address@hidden> 写道:

> Hi,
> 
> when writing the server side with DO I do (since I copied it from the 
> examples I found around the net, including our tutorial):
> 
>    // we set up distributed objects
>    port1 = [NSPort port];
>    port2 = [NSPort port];
>    kitConnection = [[NSConnection alloc] initWithReceivePort:port1
> sendPort:port2];
>    [kitConnection setRootObject:self];
> 
> the kitConnection is a local variable to the method which does nto get 
> released, thus the compiler will complain that it is leaked.
> Now I do wonder, shouldn't it be released? Some examples put in an extra 
> "retain" even, surely useless, since it is an alloc'd object.
> If it should be released when? Perhaps it is wrong or "dirty" to put this 
> connection in an method-local variable and for cleaniness it should be an 
> ivar and released on object deallocation (= essentially never, since in my 
> case it is the App Controller).
> 
> 
> Riccardo
> 
> _______________________________________________
> Gnustep-dev mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/gnustep-dev




reply via email to

[Prev in Thread] Current Thread [Next in Thread]