memory leak?

me281

Registered
I would appear as though i have a memory leak somehow, but i am not sure


I have a TiPB 500 with 768Mb of ram.

after about 15 mins of normal use i have only 100MB of un-used ram.

I have no idea what could be causing this but it is really annoying.

any ideas of a tool i can use to see what app is taking up my ram?

thanks,
me.
 
That was exactly what i was looking for, now here is what i discovered.



Memory usage getter confirms that 577MB out of 768MB of ram is being use.

i went through all of the open processes and added up the amount of ram each process is using and cam to a grand total of about 250MB of ram being used.

what is going on with the 307MB of ram that is un-accounted for

thanks,
me
 
Are you using IE by any chance? There was a screenshot of IE taking 977 MB of RAM floating around...

I haven't used MUG yet (sorry, simX) but I do use 'top' from the Terminal. Does MUG show all processes running? Or just applications?

(To use top, just go into a Terminal window and type (surprise!) top. Press Q to quit)
 
Let us explain the basics of Mach VM, as modified by FreeBSD and included in OS X.

You are probably confused by the top line similar to:

PhysMem: 28.8M wired, 60.3M active, 137M inactive, 227M used, 29.4M free

The wired memory contains the valid mapping and cannot be paged out; this is kernel plus possibly message passing areas.
Active memory contains the valid mapping (i.e. it is mapped to the memory image of running processes).
Inactive memory is not mapped into any running process, but contains valid data (i.e. it is known from which file this data came, and the file has not changed in the meantime). In order to use files mapped in inactive areas, it is enough just to map the pages to the process trying to access them. This is your filesystem cache.
Free memory has no valid mapping nor valid data; it can only be used as demand zeroed memory. It usually comes from heap or stack of defunct processes, or has never been used so far.

The memory allocation mechanism of Mach VM attempts to map already present pages (from active or inactive memory). If these are not present, free pages are used (i.e. loaded with data and made active). If these are not sufficient, least recently used (algorithm is not strictly LRU) inactive pages are re-loaded with data (or zeroed if needed for heap or stack) and made active.

This is a very rough (and quite possibly not very accurate) description of the VM behavior.

Going back to your question, you do not have a memory leak. Furthermore, just adding up the RSS of all processes will easily exceed the actual RAM, because shared pages count twice in top output. Pages get shared if you have more than one instance of an executable running, or a shared library is mapped in more than once, etc.
 
me281: What you're observing is actually nothing to worry about. Here's a snippit from the documentation of Memory Usage Getter that will be included with the as-of-yet-unreleased version 2.0.2 of Memory Usage Getter.

I didn't believe the overall memory usage progress bar, and went through the tedious task of adding up the memory usage of all my applications. My suspicions were correct! The cumulative amount does not match the amount displayed on the progress bar. In fact, the progress bar is drastically overestimating the memory usage. Is this a bug?

Yes, you've found a documented bug! I intend to leave this bug intact, however.

No, no, I'm kidding. This isn't a bug. Allow me to explain.

If you read up on the other sections of the documentation, you'd know that Mac OS X has a very efficient memory managament system. Well there's one thing that I neglected to mention: data often resides in memory even if it is not being used by any application. This is because this memory may be used in the near future, and so Mac OS X conveniently stores this data in memory, so that it doesn't have to take the time to find it again when it needs this memory. One kind of data that is often stored in memory is resources that are needed to launch applications. If you've ever noticed that applications launch faster after already having launched them once, then you're noticing this feature of Mac OS X.

The problem is, there's no specific process that is using this memory. Therefore, where is it supposed to be reported? Mac OS X is lazy, and doesn't report it anywhere, except when it reports overall memory usage. Much of this stored data is in the form of "inactive" memory, and appears as "used" memory, even though technically it isn't being used. So the discrepancy you are seeing corresponds to this inactive memory.

I hope that clears it up.
 
Back
Top