gnustep-dev
[Top][All Lists]
Advanced

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

DO and "leaked" connection object


From: Riccardo Mottola
Subject: DO and "leaked" connection object
Date: Tue, 05 Feb 2013 10:20:01 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0 SeaMonkey/2.15.1

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



reply via email to

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