Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First off, it is not possible to answer thoroughly your question without analyzing your complete implementation. But, generally speaking, if I understand correctly your question, I would say that the situation you are describing is a correct one.</p> <p>You should think that there are actions that definitely have a permanent effect on memory occupation.</p> <p>E.g., if you load some images into memory through [UIImage imageNamed]`, then your image will also go into an image cache which will not be emptied when the class that loaded the image is deallocated. Another good example is that of a singleton: a singleton class occupies some memory the first time it is instantiated and it usually never releases it (before the program ends - and when I say singleton, read also any kind of static globals).</p> <p>Those are just 2 examples, but there could be many more cases of this. And it could be done in your own code, but it could also be done by some framework that your controller uses. This effect would be more likely if your controller is the first controller you instantiate in you app that uses some kind of functionality. But basically, it cannot be known before hand, I would say, but only after inspection of your program behavior via Instruments.</p> <p>The really valuable information for you is that upon successive instantiation/deallocation of you controller class, the memory occupation does not grow. Generally speaking, this is a sign of two things:</p> <ol> <li><p>your class has no memory leaks;</p></li> <li><p>your class has not <a href="http://developer.apple.com/library/ios/#recipes/instruments_help-memory-allocations-help/Finding_Abandoned_Memory/07_Finding_Abandoned_Memory.html" rel="nofollow">abandoned memory</a>.</p></li> </ol> <p>What 1+2 implies is that the overall memory consumption of your program (as far as your controller is concerned) is flat. (although it has a cost that you pay on first use).</p> <p>So, in my view, your issue is at most one of "optimization" of memory usage by your controller. As I said, one should know exactly what your controller does to know whether those 2MB comes from some cache, or whatever else (and in some cases it could be not under your control either).</p> <p>Hope it helps.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload