virtual memory of processes rising and falling erratically

The virtual memory asscoiated with several processes is rising and falling by large amounts, quickly, and erratically. How can VM spike to 1.5GB then fall to 40MB in seconds??


Watching ActivityMonitor for just one minute, I see the VM size of three processes rising to over a GB and falling back in seconds:

* Safari Web Content : ranges from 30MB to 2GB

* Flash Player (Safari internet plug-in) : ranges from 40MB to 1.75GB

* WindowsServer : ranges from 100MB to 1.5GB

I got these sizes by watching for less than a minute while I used Safari. (Sometimes I saw readings of 16EB, what's an EB?)


The process IDs are not changing so it doesn't look like these are being restarted. I am seeing very slow performance while all this happens. It seems to be related to Safari.

MacBook Pro, OS X Mountain Lion (10.8.3)

Posted on Jun 10, 2013 4:51 PM

Reply
10 replies

Jun 10, 2013 4:55 PM in response to tjhorton

Virtual memory usage is irrelevant except for a developer. It has nothing to do with the memory usage of a running process. That measure is of "real" memory.


About OS X Memory Management and Usage


Using Activity Monitor to read System Memory & determine how much RAM is used

Memory Management in Mac OS X

Performance Guidelines- Memory Management in Mac OS X

A detailed look at memory usage in OS X

Memory Usage Performance Guidelines- About the Virtual Memory System



Understanding top output in the Terminal


The amount of available RAM for applications is the sum of Free RAM and Inactive RAM. This will change as applications are opened and closed or change from active to inactive status. The Swap figure represents an estimate of the total amount of swap space required for VM if used, but does not necessarily indicate the actual size of the existing swap file. If you are really in need of more RAM that would be indicated by how frequently the system uses VM. If you open the Terminal and run the top command at the prompt you will find information reported on Pageins () and Pageouts (). Pageouts () is the important figure. If the value in the parentheses is 0 (zero) then OS X is not making instantaneous use of VM which means you have adequate physical RAM for the system with the applications you have loaded. If the figure in parentheses is running positive and your hard drive is constantly being used (thrashing) then you need more physical RAM.


Adding RAM only makes it possible to run more programs concurrently. It doesn't speed up the computer nor make games run faster. What it can do is prevent the system from having to use disk-based VM when it runs out of RAM because you are trying to run too many applications concurrently or using applications that are extremely RAM dependent. It will improve the performance of applications that run mostly in RAM or when loading programs.

Jun 10, 2013 5:18 PM in response to Kappy

I am a developer, but not versed in Mac OS. Virtual memory of a process should not go up and down like this, in my experience.


Years ago I saw similar behavior on another Unix. Every so many seconds, a process was looking for the last N lines of a file. It allocated a 2GB memory block to read the file in, then read the file, took what it needed and then freed the block. The 2GB allocation meant that the OS had to go through and piece together and fit into swap space, then tear it down. Performance was obviously terrible.

Jun 10, 2013 5:31 PM in response to tjhorton

Suppose you remove Flash from your computer and restart. Does this problem cease? If you do a restart and don't run Safari or Flash what happens? Are you using this version of Adobe Flash Player 11.8.800.75?


Open Activity Monitor in the Utilities folder. Select All Processes from the Processes dropdown menu. Click twice on the CPU% column header to display in descending order. If you find a process using a large amount of CPU time (>=70,) then select the process and click on the Quit icon in the toolbar. Click on the Force Quit button to kill the process. See if that helps.


It is quite possible there is a problem on your computer. I don't see such behavior on mine.

Jun 10, 2013 10:45 PM in response to Kappy

I only have the problem with "safari web content" and "flash player (internet plugin for safari)" when I run safari, but the virtual memory for the windowserver process regularly jumps to anywhere between 1 and 4 GB regardless.


Latest version of Flash on Mac is 11.7.700.203, there is no 11.8 available for download yet. I've reinstalled it. Perhaps I'll try removing Flash and not running Safari to see if the WindowServer problem still occurs.


I always run ActivityMonitor with "all processes" visible. The virtual memory problem does not translate into CPU; I rarely see the CPU get close to 200% (dual core). My interpretation is that the poor performance is due to heavy system time usage, to manage the virtual memory explosions that I see going off so regularly.

Jun 11, 2013 1:39 AM in response to tjhorton

I rebooted and isolated the apparent trigger. Running Safari (without any Flash content) starts the cycle of spiking virtual memory. Safari Web Content and WindowServer both start spiking at that point. Killing Safari stops it.


Typically the spike cycle repeats every 10 to 20 seconds. When virtual memory peaks, ActivityMonitor shows a final value of 16.0 EB (as in ExaBytes??) before it reverts to a small number again (e.g. 50MB).


So it seems something in the background is going haywire in Safari Web Content that translates to something going haywire in WindowServer. It doesn't look like shared memory (according to ActivityMonitor), in case anyone thinks that.

Jun 11, 2013 11:13 AM in response to tjhorton

What happens if you uninstall Flash, quit Safari, then relaunch it? Is it possible you may have a corrupted copy of Safari or a cache file?


In Activity Monitor if you double-click on the process a new window will open. The last tab on top lets you examine open files. It may help you track down what could be causing the problem. I'm reasonably sure this is unique to your system because I have not seen such a thing on any of my systems running OS X as long as I can recall.

Jun 11, 2013 2:50 PM in response to Kappy

No change. Safari Web Content still goes through periodic spikes along with WindowServer.


I removed Flash and installed the latest update Safari 6.0.5 (just released), same problem.


I can't see anything ActivityMonitor in the list of open files that tells me what caused the problem.


I see lots of performance problems with Safari going back at length, only solved with gobs of RAM. Could it be that other people's problems are due to a virtual memory problem that they didn't notice?

Jun 11, 2013 3:37 PM in response to tjhorton

Could it be that other people's problems are due to a virtual memory problem that they didn't notice?



I would doubt that since there is nothing signficant about those virtual memory numbers that would mean anything except to developers. On an application basis they represent the amount of virtual memory demanded instantaneouly versus the maximum set by the developer in the application. The readings have nothing to do with real memory usage nor with swap space VM on disk. The latter is already provided in Activity Monitor as a separate reading in the status area where the graphs are.


Have you tried using a cache cleaner such as Mountain Lion Cache Cleaner 7.0.9 to clear out system, user, font, and Safari caches? Also, check for bad fonts. Sometimes rebuilding the dyld shared cache can help:


Open terminal, type in this command, press enter.


sudo update_dyld_shared_cache


Type in your admin passsword, press enter.

Jun 11, 2013 11:49 PM in response to Kappy

What I know contradicts the claim that "the reads have nothing to do with real memory usage, nor with swap space on disk". ActivityMonitor is reporting the operating system's (OS) view of the application.


Unless Mac OS is different from every other Unix I've worked in, that means that the memory was actually allocated, either in RAM or on the swap disk.


Agreed that this memory block doesn't get anything written to it right away, but there is still overhead to find and assign the additional amount of space requested. That adds a LOT of overhead for large allocations (and I've typically seen virtual memory jump from 200MB to 2GB for example). it is sure to slow a system down.


Pleases double check Kappy, I don't think you understand how virtual memory works. It has to be allocated somewhere.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

virtual memory of processes rising and falling erratically

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.