3

When I run a virtual machine in VMware workstation, after a few minutes of use, it uses all my RAM (16GB). My system performance slows down to a crawl. The problem happens with Linux guest too but its worse with Windows guest. In VMware Workstation Preferences I have Reserved Memory set to 2GB, and specified to fit all virtual machine memory into reserved host RAM but that didn't help despite docs recommendation.

Does anyone know how to stop VMware Workstation from using up all my RAM when I run a guest Virtual Machine?

I don't have the problem with VirtualBox and I have tried to re-install VMware Workstation and the problem persist. I'd stop using it but there are some projects that require me to use VMware.

Here are further details:

When I run free -m in the terminal when VMware Workstation is open but no guest running (before firing up the VM):

             total       used       free     shared    buffers     cached
Mem:         15945       3370      12575        198         23        696
-/+ buffers/cache:       2650      13295
Swap:        19072         74      18998

After starting a Windows 10 Guest and running for a few min, if I run free -m in my host I get:

             total       used       free     shared    buffers     cached
Mem:         15945      15694        251       2182         66      12158
-/+ buffers/cache:       3468      12477
Swap:        19072         74      18998

When I shutdown the Windows 10 guest and run free -m again:

             total       used       free     shared    buffers     cached
Mem:         15945      13499       2446        197         67      10209
-/+ buffers/cache:       3223      12722
Swap:        19072         74      18998

To get my RAM back I have to run: sync && echo 3 | sudo tee /proc/sys/vm/drop_caches and then I run free -m I get:

             total       used       free     shared    buffers     cached
Mem:         15945       3312      12633        198          2        642
-/+ buffers/cache:       2667      13278
Swap:        19072         74      18998

System Host and Guest Specs

//////////////////////////////////////
System Host:
Ubuntu 14.04LTS
VMware Workstation 12 Pro Version: 12.1.1 build-3770994
///////////////////////////////////////

//////////////////////////////////////
VM Guest:
Windows10
RAM: 1984MB
Processors: 1
DisplayRAM: 1GB
///////////////////////////////////////

//////////////////////////////////////
Motherboard:
ASUS AMD M5 A97 R2.0
///////////////////////////////////////

///////////////////////////////////////
CPU:
AM3+ AMD FX 8320 8-Core 
3.5GHz 16MB Total Cache, (5GHz Max)
///////////////////////////////////////

///////////////////////////////////////
Graphics Card:
ZOTAC Nvidia Geforce GT 730
4GB DDR3 64-bit HDCP
DUAL-Link DVI, HDMI, VGA
///////////////////////////////////////

///////////////////////////////////////
RAM: 16GB
Kingston Hyperx 
2x8GB Memory Sticks 
1866 DDR3 240-pin
///////////////////////////////////////

////////////////////////////////////////
POWER SUPPLY:
EVGA 1000w PS
1000GQ
80+ Gold series
///////////////////////////////////////

Update, 19th September 16

(Note that this is additional information by @granjow, which hopefully represents the OP’s experience.)

To add some clarifications, the problem is not that the number in the “free memory” column is small and we are just unhappy about this number because large numbers are nicer. The problem is that system performance is actually terrible.

The problem manifests itself as follows: After starting the VM and some programs, the amount of free memory drops, which is to be expected. The amount of memory used by VMware rises far over the configured limit (i.e. 10 GB instead of 4 GB, with only 8 GB of physical RAM in total). At some point, both guest and host start freezing for > 10 s on several occasions: for example navigating in files in WebStorm (guest), opening a new browser tab or terminal tab or just pressing Alt-Tab (host).

When observing CPU load on those occasions, the guest CPU usage goes to 100 % for as long as the system freezes, but no program is showing up as busy in the task manager. Basically, I can observe the typical symptoms of a system running out of RAM and heavily using the disk as cache. When observing the VMware log, there is often a line about ballooning kicking in, which is said to be the very intelligent mechanism of VMware which manages and releases memory freed by the guest.

We are not talking about bad specs of the host machine, because

  • exactly the same VM has been running on exactly the same hardware on Windows 10 smoothly without ever experiencing performance issues
  • the same VM, imported in VirtualBox on Ubuntu, runs equally well as with VMware on Windows 10, with htop/glances showing constant memory usage of around 4.6 GB, and with no freezes at all.
23
  • 3
    Unless I’m missing something, it looks like the memory is used only for cache? That’s exactly how it should be! Free memory is wasted memory.
    – Daniel B
    Commented Sep 16, 2016 at 10:18
  • 1
    What kind of physical memory are you using for the system and VM? Depending on what is happening it might be your I/O performance is just insufficient, especially if you're still busy installing one of the guest operating systems. Shouldn't be as much of an issue if the guest is actually installed and just idle.
    – Seth
    Commented Sep 16, 2016 at 11:20
  • 1
    @SimonA.Eugster I don’t know. Maybe the CPU is too busy, maybe the fixed drive (mechanical?) is too busy.
    – Daniel B
    Commented Sep 16, 2016 at 11:30
  • 1
    By physical memory meant like are you running from an HDD/SSD. You wouldn't necessarily notice the stutter in your VM if it's still busy installing or something. Which is why I asked whenever the windows machine was idle or busy. It could be busy using the whole bandwidth the HDD has to offer in order to unpack some files or similar. If it is idle and this happens maybe try an older build of Workstation or consider contacting VMWare?
    – Seth
    Commented Sep 16, 2016 at 11:40
  • 1
    You can't save RAM for later. Using your RAM is good because the only thing you can do other than use it is waste it. If you have a performance problem, tell us about that in as much detail as you can. (When does it happen. What makes it go away? What specifically is slow? And so on.) Commented Sep 18, 2016 at 0:39

4 Answers 4

1

You're worrying over nothing. Unused ram is wasted ram. Your system as such will intelligently use leftover ram for cache, speeding up things as needed.

top's a nice tool - it gives you some useful information, but a more holistic approach may be needed - iotop or similar tools would show this. My suspicion is that its storage being slow, and virtualbox and vmware handle IO and ram usage differently. A 'fix' might be to use an ssd and/or to run the VM off different storage than the main system to see if that helps. I run my system off an SSD and my VMs off a large, 7200 rpm disk, though I've toyed with getting an SSD for just that.

1
  • Thanks; I tried observing IO with iotop/glances, though it freezes as well when the system freezes, therefore I could not find anything so far. Regarding storage, I have added more details to the OP’s question, the system is actually using a SSD (which is very nice because you can suspend and resume as fast as some office programs open and close :-] (But maybe consider a SSD which is built for many R/W operations, the cheaper SSDs with triple cells (TLC) are perhaps more dangerous. Commented Sep 20, 2016 at 11:00
1
+50

At no point has your system actually run anywhere near out of memory. No action is required.

What's going on here is that the large amount of disk activity caused by normal operation of the virtual machine is causing the system to fill the otherwise unused memory on the system with cached data. Essentially, Linux takes data that's frequently or recently accessed from disk (which in your case is mostly data read by the VM's virtual disk) and stores a copy in RAM to increase performance. This is done because RAM is much faster than any hard drive or flash SSD. If other applications on the host machine need more memory, the system will simply release some of the cached data and allocate it to those applications.

The actual amounts of physical memory in use and available to applications, ignoring cached data, is listed in the -/+ buffers/cache row. Your system had some 12 GB of usable memory remaining while the VM was running, but most of it was used for cached data. This behavior is normal, and you do not need to do anything about this. In fact, manually flushing the cache (with sync && echo 3 | sudo tee /proc/sys/vm/drop_caches) will degrade system performance as the system will need to access the disk to read data rather than just retrieve the copy in RAM.

Your slow system performance is likely to be caused by high disk load while the VM is running. If you're using a mechanical hard drive, consider upgrading to an SSD.

More information on how Linux uses free memory to cache data can be found at "Linux ate my RAM!".

2
  • Why was this (and Journeyman Geek's) answer downvoted?
    – bwDraco
    Commented Sep 18, 2016 at 4:11
  • Although the original question could not be resolved, this answer is quite informative, I will therefore give the bounty to you. Better than losing it unused. Commented Sep 22, 2016 at 11:35
1

After multiple re-installations of the OS and different configurations, the issue I posted was narrowed down to either my motherboard, ram or CPU.

I used the same hard drive (an SSD by the way) in another slower system (6th gen intel i5, 2.3GHz / 2.8GHz processor), with the same OS, and with the same amount of RAM but different sticks and did not experience the problem anymore. The user that posted the bounty to bring so much attention to this 2 month old post may want to run some thorough test on their hardware.

3
  • That is interesting. So after re-installing Ubuntu+VMware, you could reproduce the problem, but not when you change to a different mainboard? Commented Sep 20, 2016 at 11:04
  • 1
    That is correct, i was able to reproduce the issue with multiple re-installs of ubuntu (mate and kde flavors) and vmware. When i switched to another motherboard, i expected the issue to persist because i assumed it must be a problem with vmware on Linux host. To my surprise all problems went away and the only variables that were changed was a different motherboard, ram and cpu. Odly enough, the old hardware is currently supporting a CentOS7 nas with kvm/qemu hypervisor with no problem.
    – jtlindsey
    Commented Sep 20, 2016 at 22:41
  • Maybe it is a VMware problem with this hardware and this host system? My solution is now to use VirtualBox instead of VMware. Commented Sep 22, 2016 at 7:05
0

This issue happens on my machine too (32GB of RAM). VMWare fills all the RAM and after a short time the system slows down dramatically.

VMWare fills the "cache RAM" - this is unused RAM which it uses as a cache. Theoretically this should NOT require any action, as bwDraco writes.

Unfortunately that's not true in practice. This problem started with VMWare 10, earlier versions did not have this problem.

It can be checked with htop. See the yellow bar for "Mem". If this yellow bar (usage of cache RAM) is at the right, then the cache is full and the machine slows down.

I don't know the reason for this problem, but I have a solution which works well:

Using a cron job I execute this command every three minutes:

sh  -c  "sync; echo 3 > /proc/sys/vm/drop_chaces"

This clears the VMWare cache and the machine runs smoothly with no performance issues.

One possible explanation could be that VMWare eats up all the cache RAM and there is no more cache for the Linux kernel. VMWare never releases this memory but Linux also needs some cache to work faster.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .