VMware Communities
Trideep_Gogoi
Contributor
Contributor

VMWARE Fusion not releasing memory after quitting

I noticed a strange memory issue with VMware Fusion Beta 3.

I have a Macbook Pro core Duo 2.0 MHz with 2GB ram and 80GB HDD

On a fresh start activity monitor shows that i have the following memory characteristics.

Wired: 123.34 MB; Active: 173.07MB; Inactive: 187.74MB; Used: 485MB; Free 1.53 GB; VM Size(OS x Page file) 5.71 GB

After stating VMware i restore my Windows appliance that has been assigned 800MB. It takes a bit of restore and ends up taking 856MB, which is perfectly fine as I am running Visual Studio for testing purposes. the VMruns very very fast with no lags and the performance on OS X is also very very good

So while running VMware my Memory characteristics are as follows

Wired: 260.23MB; Active: 800.62 MB; Inactive 379.54MB; Used 1.37GB; Free 636MB; VM ize (OS x page file) : 7.16 GB and VMware-vmx taking up 820MB

Heres the strange thing after i quit VMware (during quit it also suspends the virtual appliance) i get the following memory characteristics.

Active 129.77MB; Active: 864.38MB; Inactive: 341.79MB; Used 1.30 GB; Free 712MB; VM Size(OS x pagefile): 5.71GB

Where did my memory go? The running programs do not add up to the abnormal useage. It seems like once vmware quits it takes the memory with it. Performance issues after vmware quits is not an issue os x is very very snappy like always. But i never seem to get that memory back. If i use a different program like Garageband which takes up about 600MB however right after i quit it i gives me all the memory back.

If I relaunch vmware and open the appliance again it restores very very fast. this is even if i have been doing a lot of other things on my computer. If i continue to keep launching and quitting vmware fusion the "free" memory keeps decreasing and the "Active" keeps growing till i hit under 100Mb free and 1.8GB active after which the system becomes unusable.However Launching VMware is now very very fast and the VM runs very very good.

I understanding is this: somehow everyone the Vm launches all the stuff is being cached in RAM thus subsequent launches are fast. but after quitting the cache is no given back.

Reply
0 Kudos
40 Replies
fuzzy-wan
Enthusiast
Enthusiast

I don't know if it's by design or not, but for me anyway, I find the slightly longer boot time for a hibernated VM preferable to seeing all of that yellow in the Activity Monitor pie chart after suspending. As a workaround it's good enough for my purposes.

Reply
0 Kudos
img47
Contributor
Contributor

I hope this problem will be fixed, the hibernation workaround does not work in other systems like Ubuntu.

Reply
0 Kudos
img47
Contributor
Contributor

In RC1 Active memory is still not released when suspending virtual machine.

Reply
0 Kudos
bgertzfield
Commander
Commander

Hi img47,

Can you run Activity Monitor and report the Real value for the top 5 processes (sorted by Real memory) at the following times:

1) Before starting VMware Fusion

2) After starting VMware Fusion and resuming a VM

3) After suspending the VM

Thanks!

Reply
0 Kudos
img47
Contributor
Contributor

Hi, this is for Windows XP Pro, 512MB of memory assigned:

Before (Active = 314)

kernel_ task 117

WindowServer 49

Finder 21

ActivityMonitor 15

Wather DashboardClient 10

Running, normal Windows boot (Active = 357)

vmware-vmx 677

kernel_task 110

WindowSever 58

VMware Fusion 35

Finder 21

Suspended, VMware not running (Active = 824)

kernel_task 116

WindowServer 48

Finder 21

ActivityMonitor 15

Wather DashboardClient 10

Running, Windows restored form suspended state (Active = 901)

vmware-vmx 674

kernel_task 118

WindowSever 64

VMware Fusion 58

Finder 21

After shutting down Windows and quitting everything comes back to "Before" state (including Active memory).

Reply
0 Kudos
bgertzfield
Commander
Commander

Hi img47,

Thanks for posting your numbers!

I'm not 100% sure here, but I believe the "Active" memory usage you're seeing here is actually Mac OS X's disk buffer cache. By default, Fusion caches virtual disks in Mac OS X's buffer cache for performance reasons.

You can turn this off in RC1 via the VMware Fusion -> Preferences menu, and selecting "Optimize for Mac OS application performance".

I'll pass this information on to our memory guru to see if there's any more significance to these numbers, but it might take a few days with the holiday to get an answer. Sorry about that!

Reply
0 Kudos
img47
Contributor
Contributor

Thank you for the information!

Those numbers where captured with "Optimize for virtual machine disk performance". I have done quick test with "Optimize for Mac OS application performance" and it seems there is no significant change (active memory still behaves the same way).

Reply
0 Kudos
bgertzfield
Commander
Commander

Hi img47,

I spoke with our memory expert. Here's the info you need to know.

As a quick summary: there isn't a memory leak here, but you have uncovered a small inefficiency in VMware Fusion's suspend routines.

The pie chart in Activity Monitor assigns one of four categories to each page of physical memory on your system.

"Active" doesn't necessarily mean memory that's allocated to a process. Active memory is just memory that's been recently touched. This category includes disk cache that's actively in use.

"Inactive" means memory that has not recently been touched, and has been stored on disk (either to the swap file, or for disk cache, by the normal disk storage system). When an application needs memory, it first uses "Free" memory, then starts taking "Inactive" memory.

A virtual machine's memory is backed on disk with a .vmem file. When suspending, we explicitly touch each page of memory to mark it as dirty, so it's correctly written to disk. (When powering off, we just tell Mac OS to discard the memory, which is why it's marked as "free" for you in that case.)

Because of how Mac OS X's unified buffer cache works, this causes all the cached pages of the .vmem file to be marked as "Active", even though they're not in use.

Now, you're correct that if we could find a way to mark these pages as "Inactive", it would be better for Mac OS performance, since applications that need memory could take the unused disk cache pages from the .vmem file before forcing other active applications to swap to disk.

However, it's not a memory leak, and the Active memory you see \*will* be reclaimed by Mac OS when it's needed, as the OS notices it hasn't been touched in some time.

Anyway, hope this was helpful, and thanks for reporting it!

Reply
0 Kudos
img47
Contributor
Contributor

Thank you for the information. I hope you will find the solution for this for final release, so that memory management will be perfect Smiley Happy

Reply
0 Kudos
img47
Contributor
Contributor

Still the same in 1.0.

Reply
0 Kudos
img47
Contributor
Contributor

Fusion 2 Beat still does not release memory, when suspending virtual machine.

Reply
0 Kudos
admin
Immortal
Immortal

If you're seeing what bgertzfield describes (e.g. the memory does eventually gets reclaimed), this is how OS X memory management works, it's not a bug.

Reply
0 Kudos
img47
Contributor
Contributor

Yes, but I still hope this "small inefficiency in VMware Fusion's suspend routines" could be fixed. Parallels does it right, so Fusion can too Smiley Happy

Reply
0 Kudos
siena
Contributor
Contributor

Hi,

I have experienced the same problem as discussed in this thread. I ran VM Ware Fusion 1 for a year and half and always suspended my virtual machine before closing it and never noticed my memory being depleted. I installed VM Ware Fusion 2 and then it started depleting Gigs of memory every time I used my virtual machine. I then uninstalled VM Ware Fusion 2 and went back to 1 hoping that would solve the problem, but even now that I am back using 1, my memory is still disappearing. I have now had to resort to deleting not only many of my files but also my applications in order to run VM Ware Fusion. Now, I understand better what is happening, but am not sure how to get back the memory that is being stored by the Virtual Machine. Is there a .vmem file I can delete to recover that memory? Here are the numbers from my activity monitor:

Free: 1.18 GB VM Size (35.50 GB)

Wired 204.61 MB Page ins 1.19 GB

Active: 490.16 MB Page outs: 0 bytes

Inactive: 133.56 MB Swap used: 0 bytes

Used: 828.40 MN

As you can see from these numbers, I have 35.5 GB in the VM that I believe is the memory that hasn't been released back to the Mac OS. I don't have any big programs left on the Mac OS side to run and get that memory back because I already deleted all of them. Is there another way retrieve it?

Reply
0 Kudos
img47
Contributor
Contributor

I still have the same problem in Fusion 3.0 - when VM is suspended, memory is never released. It's stays as Inactive forever (at least 2 days). I just had 4.5 GB of inactive memory, started all mac programs to see if it gets reused, bot no, it was not. The only way to release this memory was to shut down all Fusion VMs.

Reply
0 Kudos
nbe
Enthusiast
Enthusiast

That raises the question at what process you're looking at in 'top' or Activity Monitor. Is it VMware Fusion or vmware-vmx?

How can you tell that this is memory from the suspended vm that is not being recycled as OS X normally should do?

Reply
0 Kudos
img47
Contributor
Contributor

Unfortunately I cannot find details about Inactive memory per process in Activity monitor.

My test procedure is the following:

1. Start after reboot: 280 MB of Inactive memory

2. Run and SUSPEND 3 VMs one by one (Windows 7, Windows Vista, Ubuntu)

3. Quit Fusion

4. Inactive Memory: 4.4 GB

5. Wait 20 minutes (or 1 day Smiley Happy

6. Run many memory consuming mac programs - Safari, Firefox (with many pages), all iWork and iLife, Aperture, Google Earth and 20 others - zero Free memory

7. Inactive Memory: 4.5 GB

8. Close all mac programs

9. Inactive Memory: 4.4 GB

10. Start Fusion, run each VM and SHUTDOWN one by one.

11. Quit Fusion

12. Inactive memory: 290 MB

Reply
0 Kudos
admin
Immortal
Immortal

Same thing happens in Fusion 4. But that was before I turned off hard disk buffering. I'll see how it goes now that buffering is disabled. I've just upgraded the MBP to the latest 15" with 512GB SSD, so hopefully the page outs won't be as devastating on performance like it was on the old MBP.

Reply
0 Kudos
Eski
Contributor
Contributor

Just looking at this today - MPB running bad lately, looked at Activity Monitor, vmware-vmx was running, taking up 1GB of my 4GB of RAM and VMware not running. I presume from what peoiple are saying it is because I've suspended my WIn7 image rather than shut down. Was never an issue with XP image in VMware Fusion earlier versions.

Reply
0 Kudos
infobleep
Contributor
Contributor

Given that this is such an old problem, it would appear VMWare do not consider it to be a problem and that we are simply wrong in what we would like to do. Either that or VMWare are not devoting their resoruces to fix such a problem.

Not everyone has machines with all singing and dancing processors and memory etc. etc.

So the computer will reclaim it eventually but not before I've had to wait sometime for other things to work because I don't have enough memory. In that time will my disc writting go up as it tries to keep using the little free memory I have remaining? I don't fully understand how the memory works on a mac to know if it attempts to use inactive or active memory as soon as the free memory gets very low or if it also tries to struggle on. Clearly it eventually uses the other two memories but not sure how soon.

Reply
0 Kudos