{"id":4428,"date":"2012-10-12T13:30:33","date_gmt":"2012-10-12T11:30:33","guid":{"rendered":"https:\/\/ingmarverheij.com\/?p=4428"},"modified":"2013-03-04T18:55:49","modified_gmt":"2013-03-04T17:55:49","slug":"nonpaged-memory-pool-limit","status":"publish","type":"post","link":"https:\/\/ingmarverheij.com\/en\/nonpaged-memory-pool-limit\/","title":{"rendered":"(Non)paged memory pool limit, it might be smaller then you expect"},"content":{"rendered":"<\/p>\n<p>A Windows operating systems divides memory in two spaces: user-mode and kernel-mode. By default 2GB is assigned to kernel mode (1GB if the \/3GB switch is used, which is not the case). The user-mode memory is for regular application usage, the kernel-mode memory is for \u201cspecial\u201d purposes.<\/p>\n<p><a href=\"https:\/\/ingmarverheij.com\/wp-content\/uploads\/2012\/10\/IC591391.gif\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px 0px 0px 5px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px\" title=\"\" border=\"0\" alt=\"\" align=\"right\" src=\"https:\/\/ingmarverheij.com\/wp-content\/uploads\/2012\/10\/IC59139_thumb1.gif\" width=\"204\" height=\"141\" \/><\/a>Part of the kernel memory are two pools:<\/p>\n<ul>\n<li><b>Non-paged memory pool<\/b>: Objects in this pool are never paged <\/li>\n<li><b>Paged memory pool<\/b>: Objects in this pool <b>can<\/b> be paged <\/li>\n<\/ul>\n<p>The size of these pools is limited and could become <strong>critical<\/strong>. Especially in a multi-user environment like, remote desktop shared service (RDSH), with an x86 processor architecture the paged memory pool limit can be reached sooner than you might expect. <\/p>\n<p><!--more--><\/p>\n<h2>Limits <\/h2>\n<p>The memory limits are specified on the page&#160; <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/aa366778(v=vs.85).aspx#memory_limits\">MSDN &#8211; Memory&#160; Limits for Windows Releases<\/a>. On this page you will read that for an x86 operating system the <strong>paged pool <\/strong>limit for Windows Server 2003 is <strong>530MB<\/strong> and for the <strong>nonpaged pool<\/strong> the limit is <strong>256MB<\/strong> (or 128MB with 4GT). <\/p>\n<p>Now what you probably didn\u2019t knew is that a default configured servers have a <strong>maximum <\/strong>pool size that is (a lot) smaller than the limits mentioned in the article. <\/p>\n<p>&#160;<\/p>\n<h2>Finding the actual limit<\/h2>\n<p>The actual limit of the (non)paged, the maximum size, cannot be read from the Task Manager. This can be done with either <a href=\"https:\/\/technet.microsoft.com\/en-us\/sysinternals\/bb896653.aspx\">Sysinterals Proces Explorer<\/a> or the Windows Symbolic GUI Debugger (<a href=\"https:\/\/msdn.microsoft.com\/en-us\/windows\/hardware\/gg463009.aspx\">WinDbg<\/a>). In this example I\u2019m using WinDbg since this is the most powerful tool.&#160; <em>To view the (non)paged limit in Process Explorer you need to specify the symbol search path. This is explained in article <a href=\"https:\/\/support.citrix.com\/article\/CTX129384\">CTX129384<\/a>.<\/em><\/p>\n<p>The <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/windows\/hardware\/ff565602(v=vs.85).aspx\">!vm extension<\/a> displays summary information about virtual memory use statistics on the target system. If we run this on a Windows Server 2003 SP2 x86 machine we get the following results:<\/p>\n<p><a href=\"https:\/\/ingmarverheij.com\/wp-content\/uploads\/2012\/10\/nonpaged-pool-maximum.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; margin: 0px 5px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"(non)paged pool maximum\" border=\"0\" alt=\"(non)paged pool maximum\" src=\"https:\/\/ingmarverheij.com\/wp-content\/uploads\/2012\/10\/nonpaged-pool-maximum_thumb.png\" width=\"304\" height=\"268\" \/><\/a><\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"1\" width=\"303\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"115\">&#160;<\/td>\n<td valign=\"top\" width=\"87\"><strong>Memory limit<\/strong>           <br \/><em>theoretical<\/em><\/td>\n<td valign=\"top\" width=\"70\"><strong>Actual limit<\/strong><\/td>\n<td valign=\"top\" width=\"29\"><strong>Difference<\/strong><\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"115\"><strong>           <br \/>Nonpaged pool<\/strong><\/td>\n<td valign=\"top\" width=\"87\">\n<p align=\"center\">256MB<\/p>\n<\/td>\n<td valign=\"top\" width=\"70\">\n<p align=\"center\">255MB<\/p>\n<\/td>\n<td valign=\"top\" width=\"29\">\n<p align=\"center\">1MB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"115\"><strong>           <br \/>Paged pool<\/strong><\/td>\n<td valign=\"top\" width=\"87\">\n<p align=\"center\">530MB<\/p>\n<\/td>\n<td valign=\"top\" width=\"70\">\n<p align=\"center\">178MB<\/p>\n<\/td>\n<td valign=\"top\" width=\"29\">\n<p align=\"center\">352MB<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>So where the actual <strong>nonpaged<\/strong> <strong>pool<\/strong> limit is near the limit Microsoft stated (1MB difference) the <strong>paged pool <\/strong>limit is not even close to the theoretical limit (a difference of 352MB). <\/p>\n<h5>&#160;<\/h5>\n<h5>So what happened? <\/h5>\n<p>The maximum size of the pool is <strong>calculated<\/strong> by the system during boot. The result of this calculation, based on the physical memory, is <em>an optimal value for most systems<\/em>. This implies that there are exceptions, one of them are remote desktop shared hosting-servers (RDSH, the services formerly know as terminal servers).<\/p>\n<p>&#160;<\/p>\n<h2>Changing the (non)paged pool memory size<\/h2>\n<p>By default the maximum size is determined by the system, but the actual limit (the maximum size of the memory pool) can be configured in the registry. <em>No disclaimer here, just be careful okay?<\/em><\/p>\n<p>The (non)paged memory pools are handled by the <em>Session Manager (specifically by Memory Management)<\/em>, therefor the limits (etc.) are configured in the registry key : <\/p>\n<p><em>HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management<\/em><\/p>\n<h5>&#160;<\/h5>\n<h5>Paged memory pool<\/h5>\n<ul>\n<li><strong>Value<\/strong>: PagedPoolSize <\/li>\n<li><strong>Type:<\/strong> REG_DWORD <\/li>\n<li><strong>Value<\/strong>       <br clear=\"all\" \/><br \/>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"1\" width=\"405\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"125\"><strong>Value<\/strong><\/td>\n<td valign=\"top\" width=\"275\"><strong>Description<\/strong><\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"125\">0x00000000<\/td>\n<td valign=\"top\" width=\"275\">The system calculates an optimal value<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"125\"><em>number of bytes<\/em><\/td>\n<td valign=\"top\" width=\"275\">Creates a paged pool of the specified size<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"125\">0xFFFFFFFF<\/td>\n<td valign=\"top\" width=\"275\">The system calculates the maximum paged pool allowed for the system in this configuration.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/li>\n<li>More information : <a href=\"https:\/\/technet.microsoft.com\/en-us\/library\/cc976157.aspx\">technet<\/a> <\/li>\n<\/ul>\n<p><strong>Warning<\/strong>: If you increase the paged memory pool the number of free page table entries (PTEs) will decrease. Always create a baseline of the required and number of free PTEs before \u2013 and \u2013 after the change.<\/p>\n<p>&#160;<\/p>\n<h5>Nonpaged memory pool<\/h5>\n<ul>\n<li><strong>Value<\/strong>: NonPagedPoolSize <\/li>\n<li><strong>Type:<\/strong> REG_DWORD <\/li>\n<li><strong>Value<\/strong>       <br clear=\"all\" \/><br \/>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"1\" width=\"408\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"125\"><strong>Value<\/strong><\/td>\n<td valign=\"top\" width=\"275\"><strong>Description<\/strong><\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"125\">0x00000000<\/td>\n<td valign=\"top\" width=\"275\">The system calculates an optimal value<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"125\"><em>number of bytes<\/em><\/td>\n<td valign=\"top\" width=\"275\">Creates a nonpaged pool of the specified size<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/li>\n<li>More information : <a href=\"https:\/\/technet.microsoft.com\/en-us\/library\/cc976155.aspx\">technet<\/a> <\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>A Windows operating systems divides memory in two spaces: user-mode and kernel-mode. By default 2GB is assigned to kernel mode (1GB if the \/3GB switch is used, which is not the case). The user-mode memory is for regular application usage, the kernel-mode memory is for \u201cspecial\u201d purposes. Part of the kernel memory are two pools: [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-container-style":"default","site-container-layout":"default","site-sidebar-layout":"default","disable-article-header":"default","disable-site-header":"default","disable-site-footer":"default","disable-content-area-spacing":"default","footnotes":""},"categories":[288],"tags":[516,514,515,512,130],"class_list":["post-4428","post","type-post","status-publish","format-standard","hentry","category-other","tag-limit","tag-nonpaged-pool","tag-paged-pool","tag-symbols","tag-windbg"],"_links":{"self":[{"href":"https:\/\/ingmarverheij.com\/en\/wp-json\/wp\/v2\/posts\/4428","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ingmarverheij.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ingmarverheij.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ingmarverheij.com\/en\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/ingmarverheij.com\/en\/wp-json\/wp\/v2\/comments?post=4428"}],"version-history":[{"count":6,"href":"https:\/\/ingmarverheij.com\/en\/wp-json\/wp\/v2\/posts\/4428\/revisions"}],"predecessor-version":[{"id":4722,"href":"https:\/\/ingmarverheij.com\/en\/wp-json\/wp\/v2\/posts\/4428\/revisions\/4722"}],"wp:attachment":[{"href":"https:\/\/ingmarverheij.com\/en\/wp-json\/wp\/v2\/media?parent=4428"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ingmarverheij.com\/en\/wp-json\/wp\/v2\/categories?post=4428"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ingmarverheij.com\/en\/wp-json\/wp\/v2\/tags?post=4428"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}