What is Driver Locked memory?
I noticed that one of my VMs (on Hyper-V 2012) was using a lot of RAM. Strangely, there was no application which was using that much RAM. It was using 14.2/16 GB RAM. At that time task manager showed this:
And this in the details tab:
Notice that Oracle was using only 1.8GB and that was the highest user. Even if I total everything, it still was nowhere near 14 GB used. What was using all that RAM?
To find out more details I used RAMmap tool from sysinternals. It shows me an interesting thing… there is something called “Drive Locked” portion of memory. RamMap showed this:
I was like, wait a minute!! What is grabbing 11 GB of my precious memory? I Binged 😉 and found out this is a result of using Dynamic Memory in Hyper-V. RAM allocated to the guest VM gets ballooned out (increased) in times the OS needs it and then it is set to “drive locked” when the VM does not need it anymore (balloon is ready to be deflated). This not a problem, actually. It is normal behavior.
I was worried that the next time an application needs RAM, it may resort to disk paging and run slow. I read that this is not really the case, but I was not convinced. To prove that the RAM locked is still available to the VM (guest OS) I did this:
I ran MemAlloc utility to allocate 4 GB. (Actually MemAlloc assigns only 2 GB, I think that is the max it can do….probably a 32bit app limitation? You can start another MemAlloc instance to allocate more. So the “Driver locked” value went down by around 4 GB.
So I started another MemAlloc instance to allocate 2 more GB. Now driver lock has gone down 2 GB more.
Closing MemAlloc did not increase the driver locked immediately. But task manager does show a decrease in the amount of RAM used immediately.
After a few minutes, I see that the driver locked increased to 10GB. Task manager was back up to 14.2/16.
Conclusion:
The “driver locked” memory is a RAM amount which was used by the VM at some point in the past. It is not in use anymore. It is ready to be given back to the hyper-vizor, or, if the hyper-vizor needs to assign it to some other machine, it can take it back. The RAM balloon is ready to be deflated by this amount.
This RAM is still actually available to the VM, just in case it needs it (as shown above by using MemAlloc to grab 4 GB). The OS will not resort to disk paging if RAM is suddenly grabbed. It will simply use the “Driver Locked” RAM without any problems.
References:
http://channel9.msdn.com/Shows/Defrag-Tools/Defrag-Tools-6-RAMMap
7 Comments
someguy
Thanks, simple clear and much better explanation that all the trash you find on the internet.
vasu
This worked. Thank you very much.
Cockie
Thank you! You saved me from reinstalling Windows; 24GB of RAM were allocated by my VM running in background for whatever reason…
Marc
Many thanks for this hint! This mysterious RAM consumption drove me nearly mad. There was a Hyper-V VM still running in the background since weeks now. I was completely unaware of I haven’t shut it down.
ivan
I can’t find this software, my memory is still full 15/16 GB
cgy
Great for your care and exploration!
hahaha
thank you,very much!