Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Instruments is somewhat of a black box, but here is how I think it is:</p> <blockquote> <p>There seem to be to three opposing claims here:<br> 1. Use the *Allocation*s utility of Instruments. The number of "live bytes" is the amount of physical memory used by the application. </p> </blockquote> <p>I don't know exactly what "Live Bytes" is, but it's not the amount of physical memory used by the application. I <em>think</em> it is the amount of physical memory used by all ObjectiveC objects (if this theory is correct "Live Bytes" does not contain any memory used by managed code, nor any memory used indirectly by ObjectiveC objects (such as image data), which seems to be true). "Live Bytes" is definitively useful if you want to track down leaked objects, but it's not (necessarily) a good indicator on how much memory is actually in use.</p> <blockquote> <p>2 . Use the Memory Monitor plugin. From the list of processes, pick your app and check the "Real memory" column. That's the amount of RAM currently in use. </p> </blockquote> <p>This is a bit closer: "Real Mem" is the amount of physical memory the app is using which isn't shared with other apps. The total amount of physical memory the app is using is "Virtual Mem", but big chunks of "Virtual Mem" is shared between apps (i.e. a shared library will of course use memory when it's loaded in memory, but since it's immutable it will only be loaded once for all processes. It will however be added to each process's "Virtual Mem", so if you add up the "Virtual Mem" used by all processes you will go way beyond the actual physical memory your device has).</p> <blockquote> <p>3 . Use VM Tracker and make automatic snapshots. The "Dirty Size" if what you're after.</p> </blockquote> <p>Correct. "Dirty Size" is what you're after - this is however closely related to "Real Mem", it's just "Real Mem" split into categories so you can easily see what's using the memory.</p> <p>For the typical case of using a lot of memory due to leaking images, the process goes like this:<br> 1. Verify with the Memory Monitor that your app really has a memory problem.<br> 2. See in VM Tracker / "Dirty Size" that a lot of memory is used by image data (that's the magic "Memory Tag 70").<br> 3. Use Allocations to find out where CGImages are created, see the corresponding stack trace and track down why those images aren't freed. </p> <p>Each app is different though, so it's not possible to come up with a short recipe which works for all cases.</p> <blockquote> <ul> <li>"Real Memory" drops as soon as GC is triggered</li> <li>Even if my "Live Bytes" remain around 30MB I will eventually catch memory warnings</li> <li>With constant "Live Bytes", "Real Memory" can increase significantly and easily grow to 200MB or more.</li> </ul> </blockquote> <p>All these are explained above.</p> <blockquote> <ul> <li>While using QLPreviewController and viewing an insanly big Word document (1000 pages), scrolling through that document will grow real memory like crazy. If a memory warning is received, neither real memory, not live bytes drop at all. Eventually, the app will crash; Monotouch problem or Apple's problem?</li> </ul> </blockquote> <p>It could be your problem too :) It's impossible to tell without actually knowing where the memory goes.</p> <blockquote> <ul> <li>Sometimes, real memory seems to grow and nothing can stop it. Then again, GC seems to clear big chunks of it. There is no real pattern in this.</li> </ul> </blockquote> <p>You mean you're watching real memory grow while your app is doing absolutely nothing? If you're actually doing something in your app this is completely normal.</p>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. 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