views:

676

answers:

2

Now, I know my app uses a lot of graphics, but not 60mb of graphics. However, Instruments shows me that the app is using 60+mb of virtual memory just after startup. The compiled app is 24mb big, and we're talking about the idle welcome screen after startup; any idea why the VM size might be this huge?

A: 

How/when are you loading your image?

I'll take a guess and say that 60MB is the size of your app with uncompressed images.

chris
Chris,Now that I think about it you're probably right. Memory usage = width * height * 4 or 2 in some cases, I was just looking at PNG filesize. However, that is beside the point as I am only loading about 5 or 6 images to begin with (I even checked the I/O Activity to make sure it wasn't loading more than these images). These images add up to maybe 300-400kb in PNG format.
Images are loaded from nibs.
A: 

The virtual memory is the address space allocated by your app from calls like malloc. This does not mean that it uses this much physical memory. For example, all libraries (libSystem, ...) that your app links to are allocated in shared memory, which is part of your virtual memory.

A good explanation of memory types can be found in the help of the "Activity Monitor" application. There's also a great blog post from Mike Ash.

Nikolai Ruhe