Re: ARC not ready for primetime?
Re: ARC not ready for primetime?
- Subject: Re: ARC not ready for primetime?
- From: Scott Andrew <email@hidden>
- Date: Sun, 25 Mar 2012 10:05:11 -0700
I've uploaded a quick sample that shows what i have been seeing. I put some NSLogs to show the deallocs for the NWColorViewController and NWColorLayer so you can see dealloc being called. Load in instruments Allocations app and switch back and forth a few times and end on the "Hide" tab. Basically this is creating and destroying a color view controller (my real app does this as a datasource for UIPageViewController). Go to the object list and filter by NWLayerTest, you will small amounts of memory leaked where the view controller was created and added to the subview.
This is exactly what i am seeing in my code. Bits of runtime being left behind.
i have uploaded a sample project to https://bitbucket.org/ScottAndrew/arc-memory-issue
Scott
On Mar 24, 2012, at 5:11 AM, T.J. Usiyan wrote:
> Could you post the code for the sublayer and what is the residual memory?
> On Sat, Mar 24, 2012 at 4:17 AM, Scott Andrew <email@hidden>wrote:
>
>> I seem to have hit a few limitations with ARC.
>>
>> 1.) Subclasses of CALayer are not being fully released which causes my
>> view controller to remain around. There is still some small bit of memory
>> being left behind. Even if I do the following simple code:
>>
>> -(void) viewDidLoad {
>>
>> [super viewDidLoad];
>>
>> CNFooLayer* foo = [CNFooLayer layer];
>>
>> [self.view.layer addSublayer:cup];
>> }
>>
>> Cup is:
>>
>> @interface CNFooLayer : CALayer
>> @end
>>
>>
>> If you change the above too:
>>
>> [super viewDidLoad];
>>
>> CALayer* foo = [CALayer layer];
>>
>> [self.view.layer addSublayer:cup];
>>
>> all is good.
>>
>> If I watch the object list the object allocations you can see that there
>> is residual memory left behind and my view controller is still around (even
>> though dealloc was called).
>>
>> 2.) I have a simple class with lost of properties that if i alloc and init
>> it will cause my hand created view controller to stick around. Remove the
>> alloc in the view controller and all is fine.
>>
>> I seem to be at the point now where need to remove arc and go back to
>> retain, release. The weird thing is leaks has no leaks, watching for my
>> viewController in statistics shows that it has gone away. However heapshot
>> shows residual and so does the object list.
>>
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> 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:
>>
>> This email sent to email@hidden
>>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden