BigT
BigT

Reputation: 1433

Memory Usage Really high in ARC

In my app I have noticed that it goes very slow when switching between tabs. Further investigation showed that in my memory usage test my app was over 70mb in 5 minutes of testing. My native email app was only using 40mb. This cannot happen

I am using ARC and what I thought was that if I use something like

@property(nonatomic, strong)NSString *string;

ARC will dealloc this automatically. It doesn't seem to be doing that at all.

What I would like to know is if I can reduce my memory by using dealloc in my code (when I switched to ARC it deleted all my dealloc methods) or if there is another way to speed up my app.

To give you more information on what the app does here is a list of key points:

-Gets mail messages from webservice along with pdfs

-Stores arrays to check if messages have been read, deleted, or unread

-Mail tab checks for new messages from the webservice everytime someone clicks on the tab

-Same check for pdf files

Any information will help me a lot.

Thanks

EDIT

Here are pictures of the leaks I have. Its a lot.

enter image description here enter image description here enter image description here

Upvotes: 0

Views: 287

Answers (2)

John Smith
John Smith

Reputation: 2022

I am not familiar to ARC but I suppose it may slow a bit your app. Why? Think: ARC will automatically do your "release" job, against your manual release. Suppose you have a 30 lines method, and in the first line you create an object, then in the third line you don't need it anymore and you manually release it. While ARC will wait until the end of the method to realize that your object is not needed anymore. Now suppose you make a plenty of allocations in your method, and ARC will keep them all until the end of the method is reached. Releasing manually is faster IMHO.

Upvotes: 0

werner
werner

Reputation: 859

The best way to find out what the reason is for this high memory usage is using the Instruments tool and more specifically the Leaks tool.

You can find more info on the Apple developer site here.

Hope this helps.

Upvotes: 1

Related Questions