Oracle VM VirtualBox: Ticket #5159: 3.0.6 and 3.0.8 memory leak?https://www.virtualbox.org/ticket/5159
<p>
Host is Windows Server 2008 Standard with 4 gig ram. I have one guest that runs Vista 32 and one that runs Windows 7 Pro. Both are allocated 1 gig of ram with 12 mb video. Only one guest is running at a time.
</p>
<p>
Upon initial startup Memory is consumed normally at a little over 1 gig consumed from the host.
</p>
<p>
The guests are development environments and run Visual Studio 2008 pro. I can see the memory on the host going down as I load a project, do a build, run a project and publish a project. It nevers seems to get released. I thought memory was pre-allocated so why is it going back to the host for more?
</p>
<p>
Eventually the host OS starts slowly becoming sluggish and the VM needs to be shutdown.
</p>
<p>
For Example, with no vm's running. Host has 3137mb free. Start win 7 guest, mem on host goes down to 1627mb. Start Visual studio on guest, host goes to 1597mb free, load project host goes to 1492mb free, run project host goes to 1391mb free, publish project, host to 1224mb free. This pattern continues until host mem is low.
</p>
<p>
Here's what I found interesting. If I restart the guest os, the memory does not return to the host and the instance of virtual box is never shutdown. If I do a shutdown on the guest, as soon as the virtualbox process terminates the memory is returned to the host. Not sure what else I can supply for info as there are no errors, just symptoms. But it happens on two different guests and two different versions of <a class="wiki" href="https://www.virtualbox.org/wiki/VirtualBox">VirtualBox</a>.
</p>
en-usOracle VM VirtualBox/graphics/vbox_logo2_gradient.pnghttps://www.virtualbox.org/ticket/5159
Trac 0.12frankThu, 08 Oct 2009 07:00:17 GMTsummary changedhttps://www.virtualbox.org/ticket/5159#comment:1
https://www.virtualbox.org/ticket/5159#comment:1
<ul>
<li><strong>summary</strong>
changed from <em>3.06 and 3.08 memory leak??</em> to <em>3.0.6 and 3.0.8 memory leak?</em>
</li>
</ul>
<p>
First, VirtualBox does <em>lazy</em> memory allocation, that is, even if you allocated 1GB of memory to the guest, the VM will only consume as much memory as the guest is currently accessing. Linux guest are usually more cooperative than Windows guests. Windows touches the whole physical RAM during the boot process so the guest will use the full amount of RAM you assigned when it finished booting.
</p>
<p>
So if you start two guests in parallel with 1GB RAM assigned to each of them your host will quickly loose more than 2GB of RAM. Once the memory is assigned to the guest it wouldn't be released anymore until the guest terminates. This is the expected behavior. We plan to improve this in future versions (the guest will be able to return unused memory to the host).
</p>
<p>
And even if you assign 1GB RAM + 12MB video RAM to your guest, the VMM will require some RAM (some MB) for the maintenance of the VM as well.
</p>
<p>
So once the guests are completely up and have loaded all applications, the host memory should be more or less stable. But note that the Windows memory usage indicator cannot be trusted. Windows will use a lot of RAM for disk caching and you can imagine that your two guests access a lot of different disk sectors which will induce making Windows use a lot of free memory for disk caching.
</p>
Ticketsandervl73Thu, 08 Oct 2009 07:29:23 GMTstatus changed; resolution sethttps://www.virtualbox.org/ticket/5159#comment:2
https://www.virtualbox.org/ticket/5159#comment:2
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>invalid</em>
</li>
</ul>
<p>
That's Windows disk caching grabbing memory. Windows will allocate as much memory for the disk cache as it can. There are ways to limit and monitor the disk cache size. There are several threads on the forum about this subject.
</p>
TicketMikeyMon, 02 Nov 2009 10:59:17 GMTstatus changed; resolution deletedhttps://www.virtualbox.org/ticket/5159#comment:3
https://www.virtualbox.org/ticket/5159#comment:3
<ul>
<li><strong>status</strong>
changed from <em>closed</em> to <em>reopened</em>
</li>
<li><strong>resolution</strong>
<em>invalid</em> deleted
</li>
</ul>
<p>
Something very similar has happened to me over this weekend just gone.
</p>
<p>
I left a Windows Server 2008 Standard with 4GB RAM (Host) run with a Windows NT Server 4 (Guest) for about two/three weeks and the used RAM went from 40% at the start of the Guest to 96% after about two/three weeks. I recorded this value last Friday (30th October 2009).
</p>
<p>
As the Host was still running I thought I could add another Guest (this time a Windows XP Pro) alongside the other Guest (NT Server) and see how it did over the weekend.
</p>
<p>
I came back in this morning (Monday 2nd November 2009) and I couldn't even ping the Host or get any response from it. I had to do a manual reset because all of the memory was used up.
</p>
<p>
To me this definitely looks like a memory leak with <a class="wiki" href="https://www.virtualbox.org/wiki/VirtualBox">VirtualBox</a> and not just with Windows disk caching. Also it is definitely an issue for <a class="wiki" href="https://www.virtualbox.org/wiki/VirtualBox">VirtualBox</a> on Windows not just Mac, as that's what what seems to be taken seriously at the moment.
</p>
TicketMikeyMon, 02 Nov 2009 13:15:24 GMThttps://www.virtualbox.org/ticket/5159#comment:4
https://www.virtualbox.org/ticket/5159#comment:4
<p>
Apologies. I forgot to mention that the Host (Windows Server 2008 Standard with 4GB RAM) was 64Bit. And all Guests are 32Bit. Just in case it was of any use.
</p>
TicketMikeyMon, 02 Nov 2009 14:27:46 GMThttps://www.virtualbox.org/ticket/5159#comment:5
https://www.virtualbox.org/ticket/5159#comment:5
<p>
I have now upgraded the <a class="wiki" href="https://www.virtualbox.org/wiki/VirtualBox">VirtualBox</a> on the Host to the latest version, currently at 3.0.10.
</p>
<p>
Just to confirm, I have ran both Guests (Windows NT Server 4.0 &amp; Windows XP Professional) on the Host (Windows Server 2008 Standard 64Bit).
</p>
<p>
Once both Guests were running, 70% of the Memory was reported as used by the Windows Server 2008 Resource Monitor. This has steadily climbed to 74% over the last hour. And as I see it, it will continue this upward trend until the Host runs out of Memory.
</p>
<p>
Just to confirm, this definitely appears to be a Memory Leak in <a class="wiki" href="https://www.virtualbox.org/wiki/VirtualBox">VirtualBox</a> (VB).
</p>
Ticketsandervl73Mon, 02 Nov 2009 14:53:26 GMThttps://www.virtualbox.org/ticket/5159#comment:6
https://www.virtualbox.org/ticket/5159#comment:6
<p>
The Mac issue is unrelated as the problem was in platform specific drawing code.
</p>
<p>
Second you don't really give us much information. VBox.log of such a session is essential. Also reporting the amount of memory used by the <a class="wiki" href="https://www.virtualbox.org/wiki/VirtualBox">VirtualBox</a>.exe &amp; VBoxSVC.exe process would be useful.
</p>
Ticketsandervl73Mon, 02 Nov 2009 14:57:14 GMThttps://www.virtualbox.org/ticket/5159#comment:7
https://www.virtualbox.org/ticket/5159#comment:7
<p>
Use <a class="ext-link" href="http://technet.microsoft.com/en-us/sysinternals/bb897561.aspx"><span class="icon"> </span>http://technet.microsoft.com/en-us/sysinternals/bb897561.aspx</a> to measure the size of the disk cache too.
</p>
Tickethoogie76Mon, 02 Nov 2009 15:47:59 GMThttps://www.virtualbox.org/ticket/5159#comment:8
https://www.virtualbox.org/ticket/5159#comment:8
<p>
I started this thread. Unfortunately in my setup, the memory gadget is telling me that my memory is getting low as well as basic sluggishness of the system.
</p>
<p>
Looking in task manager on the host does not show where the memory is being used at and the task manager in the guest does not show that it's using the memory. Shutdown of the guest brings my free ram up to 3gig but once the guest is running the memory slowly creeps down until I have to do a shutdown. Restart only of the guest will not release the memory only a shutdown. I have all disk caching on the guest turned off. I have to shutdown several times a day to keep working. Let me know what I can provide to help resolve this.
</p>
TicketMikeyMon, 02 Nov 2009 15:50:44 GMThttps://www.virtualbox.org/ticket/5159#comment:10
https://www.virtualbox.org/ticket/5159#comment:10
<p>
Sorry, I'll try and format better for you:
</p>
<p>
OK, I have the following for you:
</p>
<pre class="wiki">VirtualBox.exe - Commit(KB):53,704 - Working Set(KB):60,024 - Shareable(KB):17,548 - Private(KB):42,492
VirtualBox.exe - Commit(KB):56,696 - Working Set(KB):59,744 - Shareable(KB):17,768 - Private(KB):41,976
VBoxSVC.exe - Commit(KB):10,124 - Working Set(KB):15,708 - Shareable(KB):8,944 - Private(KB):6,768
</pre><p>
I have included both VM's statistiscs as well as the VBox Interface.
</p>
<p>
How do I attach the VBox.log file?
</p>
<p>
Cache Information:
Current Size: 483012 KB
Peak Size: 483992 KB
</p>
<p>
Let me know if you need anything else.
</p>
Tickethoogie76Mon, 02 Nov 2009 16:01:55 GMThttps://www.virtualbox.org/ticket/5159#comment:11
https://www.virtualbox.org/ticket/5159#comment:11
<p>
Cacheset on my guest shows my peak cache size as being 48172k. I set it to 1024k to see what affect it has on total memory. I'll keep you updated. Thanks..
</p>
TicketMikeyMon, 02 Nov 2009 16:10:14 GMThttps://www.virtualbox.org/ticket/5159#comment:12
https://www.virtualbox.org/ticket/5159#comment:12
<p>
<strong>Hoogie76</strong>, my information was for <strong>Bandervl73</strong> not you. I wasn't recommending anything, far from it I have no idea what setting the Cache Size to 1024K will do.
</p>
<p>
If you are aware of this that's OK. I would rather play it safe and inform you just in case...
</p>
Ticketsandervl73Mon, 02 Nov 2009 16:14:26 GMThttps://www.virtualbox.org/ticket/5159#comment:13
https://www.virtualbox.org/ticket/5159#comment:13
<p>
Mikey: there's an 'Attach File' button at the top.
</p>
<p>
The same numbers (process memory + cache size) after a number of hours/days would give more insight into where the memory might go.
</p>
<p>
Changing the 'Working size max' with cacheset should do the trick. I don't know what your current maximum is, but mine is 1 GB on my 4 GB machine.
</p>
TicketMikeyMon, 02 Nov 2009 16:44:26 GMTattachment sethttps://www.virtualbox.org/ticket/5159
https://www.virtualbox.org/ticket/5159
<ul>
<li><strong>attachment</strong>
set to <em>VBox.log.1</em>
</li>
</ul>
TicketMikeyMon, 02 Nov 2009 16:45:36 GMTattachment sethttps://www.virtualbox.org/ticket/5159
https://www.virtualbox.org/ticket/5159
<ul>
<li><strong>attachment</strong>
set to <em>VBox.log.2</em>
</li>
</ul>
TicketMikeyMon, 02 Nov 2009 16:46:51 GMTattachment sethttps://www.virtualbox.org/ticket/5159
https://www.virtualbox.org/ticket/5159
<ul>
<li><strong>attachment</strong>
set to <em>VBox.log.3</em>
</li>
</ul>
TicketMikeyMon, 02 Nov 2009 16:52:27 GMThttps://www.virtualbox.org/ticket/5159#comment:14
https://www.virtualbox.org/ticket/5159#comment:14
<p>
Sandervl73:
When you say: "Changing the 'Working size max' with cacheset should do the trick. I don't know what your current maximum is, but mine is 1 GB on my 4 GB machine"
</p>
<p>
Do you mean the "Working set maximum" in CacheSet? And if so, what value do you have for 1GB in KB?
</p>
TicketMikeyThu, 05 Nov 2009 14:13:01 GMThttps://www.virtualbox.org/ticket/5159#comment:15
https://www.virtualbox.org/ticket/5159#comment:15
<p>
Sandervl73, could you clarify the above for me please as I don't want to trash the Host by making a mistake. Thanks.
</p>
Ticketsandervl73Thu, 05 Nov 2009 14:36:41 GMThttps://www.virtualbox.org/ticket/5159#comment:16
https://www.virtualbox.org/ticket/5159#comment:16
<p>
Actually my 'Working set maximum' is set to 1 TB for some reason. You can change it to 256*1024 KB (262144) = 256 MB.
</p>
TicketMikeyThu, 05 Nov 2009 15:01:38 GMThttps://www.virtualbox.org/ticket/5159#comment:17
https://www.virtualbox.org/ticket/5159#comment:17
<p>
OK. I have set it to the following:
</p>
<p>
Working set minimum: 131072 KB
Working set minimum: 262144 KB
</p>
<p>
And even though I've set this, the current size is still at: 292004 KB.
</p>
<p>
Is that right?
</p>
TicketMikeyThu, 05 Nov 2009 15:09:28 GMThttps://www.virtualbox.org/ticket/5159#comment:18
https://www.virtualbox.org/ticket/5159#comment:18
<p>
Since I last posted the Current Size has now gone up to 350944 KB.
</p>
TicketMMMartinThu, 19 Nov 2009 13:45:49 GMThttps://www.virtualbox.org/ticket/5159#comment:19
https://www.virtualbox.org/ticket/5159#comment:19
<p>
I have encountered a very similar (probably the same) problem with <a class="wiki" href="https://www.virtualbox.org/wiki/VirtualBox">VirtualBox</a> 3.0.12, Vista 32bit host, Win XP SP3 32bit guest and MS Visual Studio 2010 beta. (CPU Intel C2D T5670 without VT-x support)
</p>
<p>
After starting the VM with 1024 MB RAM assigned, memory usage of the host rises gradually during boot from 1.4GB to 2.5GB. At this time, <a class="wiki" href="https://www.virtualbox.org/wiki/VirtualBox">VirtualBox</a>.exe process uses about 44MB RAM. When VS2010 is started, its logo appears, disappears and the main window opens. Its contents however do not appear, the window just hangs there. At this point, memory usage of the <a class="wiki" href="https://www.virtualbox.org/wiki/VirtualBox">VirtualBox</a>.exe process starts increasing up to about 500MB when <a class="wiki" href="https://www.virtualbox.org/wiki/VirtualBox">VirtualBox</a> crashes because of lack of memory. When the VS2010 window is closed before the crash, memory usage ceases to rise but the memory is not freed.
</p>
TicketfrankMon, 21 Nov 2011 21:11:21 GMTstatus changed; resolution sethttps://www.virtualbox.org/ticket/5159#comment:20
https://www.virtualbox.org/ticket/5159#comment:20
<ul>
<li><strong>status</strong>
changed from <em>reopened</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
</ul>
<p>
Please reopen if still relevant with VBox 4.1.6.
</p>
Ticket