I have been trying to follow the rules by the book, but somehow all the time there is something that applies in a different way.

All the time Im thinking myself if I "own" the object, who should released, is this a copy, etc, so I can decided if its on me to release it or no.

I see the property name of CALayer is a @property(copy), so this will create a new instance and retain it, as far as I understood. So its not on me To release it, directly, as you said the AutoReleasepool will release it when the CALayer will be released also.

now, im getting the name of the class by using the [[Object class] description] method, Im not allocating anything, so I don't need to release it.

So how come Im applying the M.M rules wrongly, what am I missing? :(.

thanks



Gustavo

May be I should post this on the OBj-C list, not here, but as far as it has something to do with the CALayer, I will keep it here, what you think?



On 22.3.2009, at 11:50, Filip van der Meeren wrote:

If you create a layer with a factory method, then the layer will be released automatically by an NSAutoreleasePool. I suggest you read the rules on Memory Management for Objective-C. I think that the cause of your leak is also in the trend of not knowing the MemoryManagement rules/ not applying them correctly.

Filip van der Meeren
fi...@code2develop.com
http://sourceforge.net/projects/xlinterpreter

On 22 Mar 2009, at 10:57, Gustavo Pizano wrote:

Hello, Im having a leak, (showed up by instruments), I was able to detect that its appearing when doing this:
[dLayer setName:[[shipaux class]description]];
and I have 4 more layers where Im  doing that procedure.
After doing a drag and drop Im just removing the CALayer from the superlayer, but I dunno then how to release it, if I created them as following:
        dLayer = [CALayer layer];
        cLayer = [CALayer layer];
        sLayer = [CALayer layer];
        fLayer = [CALayer layer];
        aLayer = [CALayer layer];

if I call release on any of them, the program crash.

how can I solve this situation.. its like the leak its not big, its a NSString x 5, 32Bytes each, but I like my program to be leaks free.

Thanks a lot.


Gustavo Pizano
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/filip%40code2develop.com

This email sent to fi...@code2develop.com


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to