VMware Communities
sgmelin
Enthusiast
Enthusiast

Memory usage

Hi,

my MBP has 2GB of RAM. After i booted, 220MB where used (menumeters told me that). I installed a VM (Fedora Core 6) with 512MB Guest Memory. Now i have 1280MB consumed Memory. Where is my memory?

Activity Monitor tells me 38MB for "vmware-vmx-debug" and 18,62MB for "VMware Fusion" processes.

Any ideas??

Greetings,

Sven

0 Kudos
21 Replies
bgertzfield
Commander
Commander

In general, with today's operating systems, it's not a good idea to go by "consumed memory" as a measure for how your system is doing on memory usage, as it includes the disk cache.

Mac OS will cache disk files (including the virtual disk file) in memory to increase performance; this cache will be removed as needed for running processes that need the memory for other purposes.

The memory used by your VMs will not be attributed to any process (this is the same as VMware's products on Windows host operating systems). At the moment, it shows up as "wired" memory in Activity Monitor; this may or may not always be the case in future releases.

rcardona2k
Immortal
Immortal

I have 1 GB MacBook Pro and when I open a 256 MB machine, my wired ram (in Activity Monitor) jumps about 234 MB (Guest OS fully booted) but it does grow as the machine runs.

0 Kudos
HPReg
VMware Employee
VMware Employee

Richard, your wired RAM should not grow unbounded[/u] as the VM runs. If it does, please let us know. Thanks!

0 Kudos
arraya-halim
Contributor
Contributor

I believe memory usage does in fact grow unbounded to the point the system becomes extremely sluggish (with 2GB of ram and a 256MB VM).

I've submitted a SR (#321661) and attached screen shots of activity monitor memory stats with a VM running and after the VM is shutdown.

With Fusion running a VM, my stats are as follows:

Wired: 373.51MB/Active: 1.06 GB/Inactive: 550.82MB/Used: 1.96GB/Free 39.15MB

After I quit Fusion:

Wired: 282.93MB/Active: 330.64MB/Inactive:257.55MB/Used: 871.13MB/Free 1.15 GB

This means Fusion was using over a 1 GB of ram.

0 Kudos
bgertzfield
Commander
Commander

What was the guest OS? What were you doing in the VM to cause the memory to grow? Network, disk, sound?

0 Kudos
arraya-halim
Contributor
Contributor

The VM was sitting idle while I was away the entire day. XP SP 2. Note that this VM was originally created on a Linux box running VMware Server and copied over to my Mac. This problem did not happen with the same VM on Linux.

0 Kudos
bgertzfield
Commander
Commander

Can you submit an SR so we can track this? We'll need your .vmx file so we can see what's up.

0 Kudos
arraya-halim
Contributor
Contributor

I already submitted one yesterday: #321661

Submitted the VMX as well as logs and activity monitor screen shots.

0 Kudos
admin
Immortal
Immortal

With Fusion running a VM, my stats are as follows:

Wired: 373.51MB/Active: 1.06 GB/Inactive:

550.82MB/Used: 1.96GB/Free 39.15MB

After I quit Fusion:

Wired: 282.93MB/Active:

330.64MB/Inactive:257.55MB/Used: 871.13MB/Free 1.15

GB

This means Fusion was using over a 1 GB of ram.

This means that, while Fusion was running, Mac OS found some way to use nearly all the physical memory on your system. Most of this is going to be in the form of cached disk blocks. That's not surprising- even if the VM was idle, the process of booting a VM will cause a lot of disk activity, and that disk activity will be cached by Mac OS. That said, it's a little surprising to me that the cached memory would be reclaimed so quickly after stopping the VM.

It's very hard to measure the amount of memory actually "used" by a process. Typically, on unix-like operating systems, you want to use the number of pages owned by that process that are physically resident in memory. This is RSS on linux or RSIZE on Mac OS's "top". This doesn't account for shared libraries which may be used only by that process, and it doesn't account for data that the OS is caching on that process's behalf.

Things are further complicated by the way VMware manages memory. The VM's memory isn't "allocated" from your host in a fixed block, it is paged in as needed. Any VM memory that's needed by VMware itself will show up in the vmware-vmx process, but the bulk of memory in a virtual machine ends up being needed only by the guest OS and by the VMM.

There are a lot of different ways to measure this, but the most important figure is probably wired memory. Memory that the VM is actively using is "wired" in order to keep Mac OS from reclaiming it unexpectedly. Wired memory is also now completely unavailable to other applications on your system, since Mac OS can't (on its own) swap that memory out to disk.

I can't speak for the behaviour of unreleased products, but on the VMware Fusion private beta, your system's wired memory will be roughly equal to the wired memory when no VMs are running plus, for each VM, an amount roughly equal to the working set of that VM.

In your example above, VMware Fusion was using only about 90MB above the amounts you see vmware-vmx and the UI using. (Also note that there is some overlap between wired memory and the vmware-vmx resident set, so it's misleading to simply add these numbers.)

Also, as HPreg said above, the memory usage will grow up to a point (as the VM starts utilizing more of its "physical" memory) but it should not grow in an unbounded way. Please let us know if you observe such behaviour!

0 Kudos
admin
Immortal
Immortal

arraya-halim, it just came to my attention that we have a known bug which causes VMware Fusion's kernel extensions to use far too much memory in some situations. This memory won't show up as "wired" nor will it show up in vmware-vmx's size, but it will show as a drastic increase in the size of kernel_task.

You might try this workaround. Open ~/.vmware/config, and add the following line:

sched.mem.pshare.enable = FALSE

Let us know if this helps for you. Also, please remember to remove this line from your ~/.vmware/config line before upgrading to a later release. Once the bug is fixed, this line will have no benefit and it could actually degrade the memory performance of your VMs.

0 Kudos
rcardona2k
Immortal
Immortal

On my 1 GB machine, I did notice after doing an OS install, the performance of the whole machine was going down due to Wired/Commit Charge stress.

I just added another GB to my MacBook Pro today, so I have more room to let Fusion gobble RAM. If I can get more details on this including trying the pshare thing. I'll report my findings.

0 Kudos
admin
Immortal
Immortal

Just to clarify, the pshare thing I recommended has nothing to do with wired memory- it is to fix a specific bug in which kernel_task gets very large. This bug could have been causing arraya-halim's problem, but it's unrelated to any problems you may be seeing with wired memory.

If you are seeing your kernel_task growing, do try the pshare trick and let us know if it helps.

0 Kudos
rcardona2k
Immortal
Immortal

Here's my plan:

1. Turn off any background tasks including Dashboard widgets

2. Host reboot

3. Start Activity Monitor (AM), create an AM screenshot baseline

4. Start Fusion, screenshot AM before Guest start

5. Start a WinXP SP2 + Fusion Tools Guest, allow to fully boot, take AM screenshot.

6. Simply just "use the machine" to surf, upgrade to IE 7, test the iSight etc. After about ~ 30 mins. I'll screenshot AM again.

7. Quit Fusion, final screenshot AM

I don't expect the memory profile afterwards will look like a fresh OS boot but I'll be curious as to the final mix of Wired, Active, Inactive, etc.

If while I'm running this test, the kernel_task bloats I will repeat all steps by making the config file change and rebooting the host to repeat.

0 Kudos
sgmelin
Enthusiast
Enthusiast

Hi,

i started Fusion with the Program "ObejectAlloc" from Apple´s Delevoper Tools. And there is visible, that a few threads are allocating memory, even if there is no VM running.

It´s counting, and counting, and counting. You have a memory leak. Just tell your developers, to use the tools, Apple provides. They will help you.

Thanks,

Sven

0 Kudos
admin
Immortal
Immortal

Sven,

Rest assured that we use all the tools Apple provides us to make the best product possible. We are aware of some issues related to memory in the UI process. The one you pointed out in particular isn't a memory leak but rather a bad memory allocation pattern.

The number you are seeing under Total represents the total number of allocations. You'll notice that the Current column stays constant. Basically the UI is creating and freeing objects but isn't actually leaking them.

Tracking down some of these things is of course part of the reason to distribute an F&F before the actual product.

thanks for the feedback,

shawn

sgmelin
Enthusiast
Enthusiast

Hi,

O.K. Thanks for the clearance.

Greetings,

Sven

0 Kudos
arraya-halim
Contributor
Contributor

Adding the sched.mem.pshare.enable = FALSE line fixed my issue. My system is still usable now even after leaving the VM running for over two days.

0 Kudos
admin
Immortal
Immortal

Great!

We have already fixed this issue internally, so please remember to remove this line from your config file when you upgrade to the next Fusion beta.

0 Kudos
sgmelin
Enthusiast
Enthusiast

That´s are very good news! Thanks. I´m looking forward to get the best Desktop virtualization Product on the market (of course, beats the Windows and Linux Version of WS Smiley Wink ).

Greetings,

Sven

0 Kudos