{"id":705,"date":"2014-11-11T14:39:54","date_gmt":"2014-11-11T19:39:54","guid":{"rendered":"http:\/\/rajdude.com\/blog\/?p=705"},"modified":"2014-11-11T14:42:15","modified_gmt":"2014-11-11T19:42:15","slug":"what-is-driver-locked-memory","status":"publish","type":"post","link":"https:\/\/rajdude.com\/blog\/what-is-driver-locked-memory\/","title":{"rendered":"What is Driver Locked memory?"},"content":{"rendered":"<p>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: <\/p>\n<p><a href=\"http:\/\/rajdude.com\/blog\/wp-content\/uploads\/2014\/11\/image.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"image\" src=\"http:\/\/rajdude.com\/blog\/wp-content\/uploads\/2014\/11\/image_thumb.png\" width=\"427\" height=\"362\"><\/a> <\/p>\n<p>And this in the details tab: <\/p>\n<p><a href=\"http:\/\/rajdude.com\/blog\/wp-content\/uploads\/2014\/11\/image1.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"image\" src=\"http:\/\/rajdude.com\/blog\/wp-content\/uploads\/2014\/11\/image_thumb1.png\" width=\"476\" height=\"106\"><\/a> <\/p>\n<p>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?<\/p>\n<p><!--more--><\/p>\n<p>To find out more details I used RAMmap tool from sysinternals. It shows me an interesting thing\u2026 there is something called \u201cDrive Locked\u201d portion of memory. RamMap showed this: <\/p>\n<p><a href=\"http:\/\/rajdude.com\/blog\/wp-content\/uploads\/2014\/11\/image2.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"image\" src=\"http:\/\/rajdude.com\/blog\/wp-content\/uploads\/2014\/11\/image_thumb2.png\" width=\"484\" height=\"334\"><\/a> <\/p>\n<p>I was like, wait a minute!! What is grabbing 11 GB of my precious memory? I Binged \ud83d\ude09 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 \u201cdrive locked\u201d when the VM does not need it anymore (balloon is ready to be deflated). This not a problem, actually. It is normal behavior.  <\/p>\n<p>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: <\/p>\n<p>I ran MemAlloc utility to allocate 4 GB. (Actually MemAlloc assigns only 2 GB, I think that is the max it can do\u2026.probably a 32bit app limitation? You can start another MemAlloc instance to allocate more. So the \u201cDriver locked\u201d value went down by around 4 GB.  <\/p>\n<p><a href=\"http:\/\/rajdude.com\/blog\/wp-content\/uploads\/2014\/11\/image3.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"image\" src=\"http:\/\/rajdude.com\/blog\/wp-content\/uploads\/2014\/11\/image_thumb3.png\" width=\"495\" height=\"348\"><\/a> <\/p>\n<p>So I started another MemAlloc instance to allocate 2 more GB. Now driver lock has gone down 2 GB more. <\/p>\n<p><a href=\"http:\/\/rajdude.com\/blog\/wp-content\/uploads\/2014\/11\/image4.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"image\" src=\"http:\/\/rajdude.com\/blog\/wp-content\/uploads\/2014\/11\/image_thumb4.png\" width=\"495\" height=\"358\"><\/a> <\/p>\n<p>Closing MemAlloc did not increase the driver locked immediately. But task manager does show a decrease in the amount of RAM used immediately. <\/p>\n<p>After a few minutes, I see that the driver locked increased to 10GB. Task manager was back up to 14.2\/16. <\/p>\n<p><a href=\"http:\/\/rajdude.com\/blog\/wp-content\/uploads\/2014\/11\/image5.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"image\" src=\"http:\/\/rajdude.com\/blog\/wp-content\/uploads\/2014\/11\/image_thumb5.png\" width=\"495\" height=\"411\"><\/a> <\/p>\n<hr>\n<p><b><font size=\"5\">Conclusion:<\/font><\/b> <\/p>\n<hr>\n<p>The \u201cdriver locked\u201d 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. <\/p>\n<p>This RAM is still actually available to the VM, just in case it needs it (as shown above by using <a href=\"http:\/\/www.soft.tahionic.com\/download-memalloc\/download.html\">MemAlloc<\/a> to grab 4 GB). The OS will not resort to disk paging if RAM is suddenly grabbed. It will simply use the \u201cDriver Locked\u201d RAM without any problems.      <\/p>\n<p><strong>References:<\/strong><\/p>\n<p><a title=\"http:\/\/channel9.msdn.com\/Shows\/Defrag-Tools\/Defrag-Tools-6-RAMMap\" href=\"http:\/\/channel9.msdn.com\/Shows\/Defrag-Tools\/Defrag-Tools-6-RAMMap\">http:\/\/channel9.msdn.com\/Shows\/Defrag-Tools\/Defrag-Tools-6-RAMMap<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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?<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[68],"class_list":["post-705","post","type-post","status-publish","format-standard","hentry","category-itsys","tag-hyper-v"],"_links":{"self":[{"href":"https:\/\/rajdude.com\/blog\/wp-json\/wp\/v2\/posts\/705","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rajdude.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rajdude.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rajdude.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rajdude.com\/blog\/wp-json\/wp\/v2\/comments?post=705"}],"version-history":[{"count":2,"href":"https:\/\/rajdude.com\/blog\/wp-json\/wp\/v2\/posts\/705\/revisions"}],"predecessor-version":[{"id":707,"href":"https:\/\/rajdude.com\/blog\/wp-json\/wp\/v2\/posts\/705\/revisions\/707"}],"wp:attachment":[{"href":"https:\/\/rajdude.com\/blog\/wp-json\/wp\/v2\/media?parent=705"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rajdude.com\/blog\/wp-json\/wp\/v2\/categories?post=705"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rajdude.com\/blog\/wp-json\/wp\/v2\/tags?post=705"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}