Re: Question Regarding Xcode Memory Usage
Re: Question Regarding Xcode Memory Usage
- Subject: Re: Question Regarding Xcode Memory Usage
- From: Mark Wagner <email@hidden>
- Date: Mon, 23 Aug 2010 14:36:26 -0700
On Mon, Aug 23, 2010 at 04:29, Simon Wilson <email@hidden> wrote:
> I'm using Xcode 3.1 on a MacBook Pro with 4GB RAM running 10.6.4.
>
> I've noticed a discrepancy between the RAM usage that is reported for the Xcode process and that which is actually freed when I close the application.
>
> For example, Activity Monitor was reporting Xcode as using 392.2MB real memory and 702.4MB virtual memory. It reported 316MB of free memory and a further 825MB as inactive.
>
> I then quit Xcode (routinely the consumer of the most memory) to reclaim some RAM (initial memory utilization after opening my project is far lower).
>
> Immediately after the the process terminated Activity Monitor reported 1.68GB of free memory and 700MB as inactive. Quitting Xcode apparently resulted in ~1.3GB of memory being freed. Active memory decreased by the same amount (down to 880MB from 2.1GB).
>
> Can anyone explain the discrepancy between the approx. 400MB used by the Xcode app and the almost 1.3GB that is actually freed when I close the application? As far as I can tell Xcode doesn't seem to be running any other helper processes that might explain the difference.
It sounds like you're misinterpreting things. Physical RAM is divided
into four categories, based on how available it is:
* Free RAM: Totally free, nothing is using it. Available for
immediate allocation.
* Inactive RAM: Memory that's in use by a program, but which hasn't
been touched recently. If a program needs physical memory and there
isn't enough free memory, the contents of some inactive RAM is moved
out to to the swapfile to make room.
* Active RAM: Memory that has been touched recently. This will only
be moved to the swapfile if there's no inactive or free RAM available.
* Wired RAM: Memory that is totally unavailable for moving to the
swapfile. Generally, this is core parts of the operating system, or
other things that may not be accessed very often, but which need to be
immediately available when they are.
Program memory is divided into two categories:
* Physical RAM: This is space on the memory chips that the program is
using. When you quit a program, this turns into free RAM.
* Virtual RAM: This is the total amount of memory the program has
allocated. It may include things like program code, memory
allocations, shared memory areas, or memory-mapped files. It may also
include shared libraries, but I don't know for certain how MacOS
counts those. Not all of this corresponds to physical RAM or swapfile
space: memory-mapped files count as virtual RAM, but don't take up any
space, and memory that's been allocated but never accessed exists only
as a bookkeeping record somewhere.
You're missing at least one piece of the puzzle for figuring out
what's going on: swapfile usage. It's possible that in the process of
quitting, Xcode did something that required 1.2 GB of physical RAM,
resulting in all your inactive RAM and some active RAM being swapped
out to disk, followed by 700 MB of active RAM being reclassified as
inactive.
--
Mark Wagner
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden