<p>We have some Win32 console applications running on Windows Server 2003 Service Pack 2 that regularly fail with this:</p>

<blockquote>
  <p>Error 1450 (<code>ERROR_NO_SYSTEM_RESOURCES</code>): "Insufficient system resources exist to complete the requested service."</p>
</blockquote>

<p>All the documentation we've found suggests it is linked to the number of <strong>Free System Page Table Entries</strong> running out.  We have 16GB RAM in these machines and use the <code>/3GB</code> Operating System switch to squeeze the Windows kernel into 1GB and allow our processes access to 3GB of address space.  This drastically reduces the total number of Free System Page Table Entries, so combined with our heavy use of MapViewOfFile() it is perhaps not surprising that the kernel page table entries are running out.</p>

<p>However, when using Performance Monitor to view the Free System Page Table Entries counter, the value is around 36,000 on reboot and <strong>doesn't go down when our application starts</strong>.  I find it hard to believe that our application, which opens many large memory-mapped files, doesn't have any effect on the kernel page table.  If we can't believe the counter, it's much more difficult to test the effect of any system changes we make.</p>

<p>There is a promising Knowledge Base article, <a href="http://support.microsoft.com/kb/894067" rel="nofollow noreferrer">The Performance tool does not accurately show the available Free System Page Table entries in Windows Server 2003</a>, but it says the problem has been fixed in Service Pack 1, and we are already on Service Pack 2.</p>

<p>Has anyone else struggled with or solved this issue?</p>

<p><strong>Update:</strong> I have checked !sysptes in windbg (debugging the kernel) and the value matches the performance counter, around 36,000.  I guess this is most likely to mean that there really are that many free page table entries and Windows <em>is</em> telling the truth.  It does leave the question of why we're getting 1450 errors though, if the PTEs are not running out.</p>

<p><strong>Further update:</strong> We never did get to the bottom of why the 1450 errors were occurring.  <em>However</em>, instead we upgraded the OS on these servers to 64-bit Windows.  This allows the existing 32-bit applications (without recompilation) to access a full 4GB of virtual address space, and lets the kernel memory area with those pesky Page Table Entries be as big as it likes too.  I don't think we've had a 1450 error since.</p>

[{'answer_id': 60897, 'author': 'Adam Mitz', 'author_id': 2574, 'author_profile': 'https://Stackoverflow.com/users/2574', 'pm_score': 1, 'selected': False, 'text': '<p>Can you try the windbg command "!sysptes" to get System PTE Information?  I\'m not sure if you can do this with live kernel debug, you may have to get a memory dump.</p>\n'}, {'answer_id': 139529, 'author': 'MSalters', 'author_id': 15416, 'author_profile': 'https://Stackoverflow.com/users/15416', 'pm_score': 0, 'selected': False, 'text': '<p>I\'m not sure why you assume that <code>ERROR_NO_SYSTEM_RESOURCES</code> is caused <em>only</em> by running out of free System Page Table Entries ? As far as I know, such generic error codes are used for more than one resource type. And in fact, the first Google hit suggests that running out of file cache memory may cause it too. (KB on an XP bug, which tripped this error mode).</p>\n\n<p>In your case, I\'d be checking the "Handle Count". Another possible problem is address space fragmentation. If you you want to create a 1GB file mapping view, you need 1GB of free address space, and it has to be contiguous. If you map a 1GB file, a 800 MB file, and a 1GB file, close the 800MB one and open a 900MB file, the 900MB file may not fit in the hole that\'s left.</p>\n'}, {'answer_id': 828272, 'author': 'user102015', 'author_id': 102015, 'author_profile': 'https://Stackoverflow.com/users/102015', 'pm_score': 0, 'selected': False, 'text': '<p>MS has <strong>2 ways</strong> to allow there 32 bit OS to "deal" with hardware that has 4 GB or more of RAM. </p>\n\n<p><strong>Option 1: is what you did with the /3GB Switch in the Boot.ini.</strong></p>\n\n<p><strong>Option 1 Pros and Cons:</strong></p>\n\n<p><strong>(CONS)</strong> This option sucks 1 GB from the normal 2 GB kernel area - hence making the OS struggle to meet the demands of both Paged Pool allocations and kernel stack allocations. So a person might think that using the /3GB Switch will help their, but really this option is screwing the 32 bit Window OS into a slow death.</p>\n\n<p><strong>(CONS)</strong> But, This gives my App 3GB.... WRONG (Hence this is a CON) The catch is that ONLY application that have been recompiled from the vendor to be "/3GB Switch aware" can really use the extra 1 GB. Hence the whole use of the /3GB Switch is a really BAD J.O.K.E on everyone. </p>\n\n<p>Read this link for a much better write-up:</p>\n\n<p><a href="http://blogs.technet.com/askperf/archive/2007/03/23/memory-management-demystifying-3gb.aspx" rel="nofollow noreferrer">http://blogs.technet.com/askperf/archive/2007/03/23/memory-management-demystifying-3gb.aspx</a></p>\n\n<p><strong>Option 2: Use the /PAE switch in the Boot.ini.</strong></p>\n\n<p><strong>Option 2 Pros and Cons:</strong></p>\n\n<p><strong>(PROS)</strong> This really this only option if you have a more then 4GB of RAM. It tricks a application by placing the complete application memory footprint in RAM. Normally, only a application "Working Set" memory is in RAM and the remaining application memory requirements go into Windows Pagefile. What is a application total memory requirements?? - it called "Virtual Size". </p>\n\n<p>In my world, I have a big fat Java based IBM Product that I deal with. The server that is running the "application" has 16 GB of RAM. I simply add the /PAE switch and watch (thanks to sysinternals Processes Explorer) application paging requests go from 200 KB per sec to up to 4MB per sec. </p>\n\n<p><strong>Question:</strong> "Why"? </p>\n\n<p><strong>Answer:</strong> The whole application is in RAM. </p>\n\n<p><strong>Question:</strong> "Does the application know that it is completely running in RAM?</p>\n\n<p><strong>Answer:</strong> No - It is running that same old way that it was always run, "THINKING" that it\'s has part of itself as the "Working Set" memory living in RAM and the remaining application memory requirements go into Windows Pagefile.</p>\n\n<p>Yes, it is that flipping GOOD.</p>\n\n<p>Please Note: Microsoft has done a poor job telling anyone about the great Windows OS option. Duh</p>\n\n<p>Try it and report back to stackoverflow....</p>\n'}]
['https://Stackoverflow.com/questions/59098', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5536/']