<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Demand Technology FAQ &#187; Memory</title>
	<atom:link href="http://faq.demandtech.com/category/memory/feed/" rel="self" type="application/rss+xml" />
	<link>http://faq.demandtech.com</link>
	<description>Help and Support for the Performance Sentry Product Line</description>
	<lastBuildDate>Wed, 30 Jun 2010 19:33:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>What can you tell me about Virtual Memory?</title>
		<link>http://faq.demandtech.com/2009/11/20/what-can-you-tell-me-about-virtual-memory/</link>
		<comments>http://faq.demandtech.com/2009/11/20/what-can-you-tell-me-about-virtual-memory/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 15:56:48 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Memory]]></category>
		<category><![CDATA[Memory Monitoring]]></category>
		<category><![CDATA[Memory Performance]]></category>

		<guid isPermaLink="false">http://faq.demandtech.com/?p=161</guid>
		<description><![CDATA[We have two White Papers that will help you get a better understanding of Virtual Memory:
CONSTRAINTS IN 32Bit WINDOWS and
CONSTRAINTS IN 32Bit WINDOWS &#8211; An Update
 
]]></description>
			<content:encoded><![CDATA[<p>We have two White Papers that will help you get a better understanding of Virtual Memory:</p>
<p><a title="Constraints in 32Bit Windows" href="http://www.demandtech.com/Resources/Papers/Virtual%20memory%20constraints%20in%2032bit%20Windows.pdf" target="_blank"><strong>CONSTRAINTS IN 32Bit WINDOWS</strong></a> and</p>
<p><strong><a title="Constraints in 32Bit Windows - Update" href="http://www.demandtech.com/Resources/Papers/Virtual%20memory%20constraints%20in%2032bit%20Windows%20-%20an%20Update.pdf" target="_blank">CONSTRAINTS IN 32Bit WINDOWS &#8211; An Update</a></strong></p>
<p><strong> </strong></p>
]]></content:encoded>
			<wfw:commentRss>http://faq.demandtech.com/2009/11/20/what-can-you-tell-me-about-virtual-memory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How can I tell when I am out of RAM and need to add more memory?</title>
		<link>http://faq.demandtech.com/2009/10/15/how-can-i-tell-when-i-am-out-of-ram-and-need-to-add-more-memory/</link>
		<comments>http://faq.demandtech.com/2009/10/15/how-can-i-tell-when-i-am-out-of-ram-and-need-to-add-more-memory/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 14:50:38 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Memory]]></category>
		<category><![CDATA[Memory Monitoring]]></category>
		<category><![CDATA[Memory Performance]]></category>
		<category><![CDATA[RAM]]></category>

		<guid isPermaLink="false">http://faq.demandtech.com/?p=120</guid>
		<description><![CDATA[The best single indicator of a real memory (RAM) shortage is Available Bytes. This Counter reports the current number of pages (in bytes – there are 4096 bytes in a page) in the Zero, Free, and Standby Lists that the Memory Manager maintains. This pool of available memory is used to resolve page faults quickly. [...]]]></description>
			<content:encoded><![CDATA[<p>The best single indicator of a real memory (RAM) shortage is <strong>Available Bytes</strong>. This Counter reports the current number of pages (in bytes – there are 4096 bytes in a page) in the Zero, Free, and Standby Lists that the Memory Manager maintains. This pool of available memory is used to resolve page faults quickly. So long as there is a cushion of <strong>Available Bytes</strong> that is at least 5-10% of the size of RAM, you probably have sufficient memory to run your workload.</p>
<p>It is also important to monitor <strong>Available Bytes</strong> to see if it remains at or near a threshold value of 4 MB. When Available Bytes (the sum of Zero, Free, and Standby Lists) falls below approximately 4 MB, it triggers a change in the operating system’s memory management policy. The <em>working set </em>of a process is defined as the number of virtual memory pages that it is allowed to keep resident in RAM. Normally, the working sets of processes that are running at their maximum working set size are adjusted upwards periodically by a component of the Windows Memory Manager. This allows processes that need more RAM to grow their working sets over time. However, when <strong>Available Bytes</strong> are in short supply, the working sets of processes already running at their maximum working set size are no longer adjusted upwards. Since this change in policy often leads to increased paging activity, it is a good idea to monitor <strong>Available Bytes</strong> and set off an alarm whenever you find it hovering consistently at about 4 MB.</p>
<p>Figure 1 below is a graph showing the utilization of RAM on a Windows 2000 server that shows <strong>Available Bytes</strong> dropping sharply to 4 MB shortly after 20:15 and stabilizing at that point afterwards. The other Counters charted represent real memory usage in various system-managed pools: as usual, the non-pageable pool, the pageable pool, and resident bytes in the file cache are the most significant consumers of real memory. In this instance, something causes resident cache bytes to increase (evidently due to some file access activity), which serves to deplete the supply of <strong>Available Bytes</strong>. Notice that once Available Bytes drops to 4 MB, it stabilizes at that value, even as the file cache expands (probably at the expense of RAM-resident process <strong>Working set bytes</strong> (not shown). The change in memory management policy allows the Windows Memory Manager to maintain the pool of <strong>Available Bytes</strong> at a relatively constant level. But, because RAM is in short supply, something has to give. The result is a predictable increase in demand paging.</p>
<p><img src="http://www.demandtech.com/FAQSmem_files/image001.jpg" border="0" alt="" width="597" height="510" /></p>
<p><strong>Figure 1</strong><strong>. </strong><em>RAM usage on 256 MB Windows 2000 Server.</em></p>
<p>Figure 2 covers the same interval, showing the demand paging statistics from the Memory Object. These Counters report a corresponding rise in the page fault rate once <strong>Available Bytes</strong> drops to 4 MB. <strong>Cache Faults/sec </strong> represent read file operations that miss the cache and require accessing data from disk. This file cache activity apparently accounts for the expansion of the <strong>System Cache Resident Bytes</strong> depicted in Figure 1. Because there is contention for RAM among executing processes, the hard page fault rate also increases. The hard page fault rate charted here corresponds to the <strong>Page reads/sec</strong> Counter in the Memory Object. Together, <strong>Available Bytes</strong> hovering at 4 MB <em>and</em> a corresponding increase in the rate of hard page faults strongly suggests a situation where it would be useful to add more RAM. This example also illustrates the fact that the system file cache, which is part of the System address space working set, competes for memory on equal terms to other process working sets.</p>
<p><img src="http://www.demandtech.com/FAQSmem_files/image003.jpg" border="0" alt="" width="589" height="477" /></p>
<p><strong>Figure 2</strong><strong>. </strong>Demand paging rates can spike when the pool of Available Bytes is depleted.</p>
<p>Unfortunately, the relation between a memory shortage and the onset of demand paging illustrated here is usually not so clear-cut in many of the systems you will get a chance to observe. You also need to be aware that applications like MS SQL Server and Exchange running on Windows Server will grow their working sets dynamically to absorb any excess RAM that is available. It is not unusual to see systems running MS SQL Server or Exchange running at or near the 4 MB line without excessive paging. These applications also bypass the standard system file cache and buffer recently used database objects within their own memory-resident working sets. To diagnose shortage-of-memory conditions for these apps, it is necessary to look beyond the system level Memory statistics and examine their internal cache statistics.</p>
]]></content:encoded>
			<wfw:commentRss>http://faq.demandtech.com/2009/10/15/how-can-i-tell-when-i-am-out-of-ram-and-need-to-add-more-memory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How do I find a memory leak?</title>
		<link>http://faq.demandtech.com/2009/09/29/how-di-i-find-a-memory-leak/</link>
		<comments>http://faq.demandtech.com/2009/09/29/how-di-i-find-a-memory-leak/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 15:30:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Memory]]></category>
		<category><![CDATA[Windows Performance]]></category>

		<guid isPermaLink="false">http://faq.demandtech.com/?p=24</guid>
		<description><![CDATA[A memory leak refers to a programming bug where an application program repeatedly allocates virtual memory, but never deletes it. Eventually, a program with a memory leak will cause something bad to happen. For example, the system or some of its applications might lock up because all the available virtual memory is allocated.
Several aspects of [...]]]></description>
			<content:encoded><![CDATA[<p>A memory leak refers to a programming bug where an application program repeatedly allocates virtual memory, but never deletes it. Eventually, a program with a memory leak will cause something bad to happen. For example, the system or some of its applications might lock up because all the available virtual memory is allocated.</p>
<p>Several aspects of typically memory leaks make them especially insidious programming bugs. A program with a memory leak is not obviously incorrect, and may even produce the correct output or calculate the proper results. Memory leaks are often not evident until a program has been executing successfully for hours, days, or weeks.  It is not always obvious which program is causing the memory leak. The memory leak may not manifest itself in the same way all the time. A program with a memory leak will eventually exhaust the supply of virtual memory pages available so that simple calls to allocate a new segment of virtual memory fail. When simple application calls to allocate a new segment of virtual memory fail, the results are often unpredictable. Finally, applications frequently make calls to allocate and free virtual memory. These calls are typically sprinkled in various spots in the program. Because system functions and DLL library routines also make frequent calls to allocate and free virtual memory, it is not easy to isolate what is causing the bug in the program. Fortunately, there are excellent <a href="http://www.compuware.com/products/numega/bounds/">automated tools</a> for Windows application developers that can help programmers find many types of memory bugs. There is no excuse for not using some of these development and testing tools on your Windows 2000 applications in order to catch many types of memory leaks before they manifest themselves in critical product environments.</p>
<p>The procedure for finding a memory leak depends on what type of virtual memory is being allocated. The bug may be local to an application so that its only effect is on the process virtual address space where the leak is occurring. The bug may be in a shared DLL or other common module so that the bug will be manifest first in this application and then that one. Finally, the problem could be a leak affecting shared system memory, which can make it very difficult to pinpoint the specific application or module causing the leak. To diagnose a memory leak, be prepared to look at any or all of the following:</p>
<p><em>% Committed Bytes in Use.</em> The <strong>Commit Limit</strong> is an upper limit on the amount of virtual memory that can be allocated on your system. The <strong>Commit Limit</strong> is tied to the size of RAM and the amount space defined for paging files (and remember that paging files can and do expand the system looks like it may run short of virtual memory). The <strong>% Committed Bytes in Use</strong> Counter reports Committed Bytes as a percentage of the Commit Limit. Whenever <strong>% Committed Bytes in Use</strong> exceeds 80-90%, application requests to allocate</p>
<p><em>per process Virtual Bytes. </em>Virtual Bytes records the amount of virtual memory allocated by individual processes. If the program with the memory leak is allocating virtual memory in its own address space, the memory leak should be evident by tracking the per process Virtual Bytes Counter. If the amount of Virtual Bytes allocated for a process increases steadily over the life of a process, there is good reason to suspect a leak.</p>
<p><em>Pool Paged Bytes.</em> Virtual memory for various system functions, including shared memory files (like DLLs), is allocated from the Paged Pool, which is an area of the system&#8217;s virtual memory that is limited in size. A program with a memory leak that is allocating, but never freeing memory from the Paged Pool will eventually exhaust the Paged Pool. Subsequent allocations that request the Paged Pool will then fail, with unpredictable (but predictably bad) results. The <strong>Pool Paged Bytes</strong> Counter in the Memory Object reports the current number of bytes allocated from the Paged Pool. The upper limit on the size of the Paged Pool is calculated by the system at start-up. This calculation can be overridden by setting the Paged Pool Limit explicitly using the Registry parameter <strong>PagedPoolSize</strong> at HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management. In either case, the upper limit on the size of the Paged Pool, according to Microsoft documentation in Windows 2000 Resource Kit is 192 MB in NT 4.0 and up to 470 MB in Windows 2000.</p>
<p><em>Pool Nonpaged Bytes. </em>Some kernel functions and device drivers in particular require real memory buffers that can never be paged out of the system. These programs allocate memory from the nonpaged pool, which also has an upper limit.  A device driver with a memory leak will eventually exhaust the supply of Nonpaged Pool Bytes, which will cause subsequent allocations that request the nonpaged pool to fail. Running out of space in the nonpaged pool often results in a Blue Screen.</p>
]]></content:encoded>
			<wfw:commentRss>http://faq.demandtech.com/2009/09/29/how-di-i-find-a-memory-leak/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How can I tell how much RAM is being used by application processes and various operating system functions?</title>
		<link>http://faq.demandtech.com/2009/09/29/how-can-i-tell-how-much-ram-is-being-used-by-application-processes-and-various-operating-system-functions/</link>
		<comments>http://faq.demandtech.com/2009/09/29/how-can-i-tell-how-much-ram-is-being-used-by-application-processes-and-various-operating-system-functions/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 15:27:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Memory]]></category>
		<category><![CDATA[Windows Performance]]></category>

		<guid isPermaLink="false">http://faq.demandtech.com/?p=21</guid>
		<description><![CDATA[It is not possible to get a complete accounting of RAM usage on a Windows, but you can get reasonably close. RAM usage by various OS functions is measured by the following five Memory Object counters:
Pool Nonpaged Bytes: these represent allocations directed to the nonpaged pool, which is a set virtual memory pages that always [...]]]></description>
			<content:encoded><![CDATA[<p>It is not possible to get a complete accounting of RAM usage on a Windows, but you can get reasonably close. RAM usage by various OS functions is measured by the following five Memory Object counters:</p>
<p><em><strong>Pool Nonpaged Bytes:</strong></em> these represent allocations directed to the nonpaged pool, which is a set virtual memory pages that <em>always</em> remain resident in RAM. (These are <em>nonpageable</em> bytes.) Device drivers and the OS use the nonpaged pool to store data structures that must stay in physical memory and can never be paged out to disk. (For example, the TCP/IP driver must allocate some amount of nonpaged memory for every TCP/IP connection that is active on the computer for data structures that are required during processing of network adaptor interrupts when page faults cannot be tolerated.)</p>
<p><em><strong>Pool Paged Resident Bytes</strong>:</em> Most virtual memory pages that are acquired in the Operating System range of virtual addresses can be paged out. The <strong>Pool Paged Resident Bytes</strong> represent memory locations from the pageable pool that currently reside in RAM.</p>
<p><em><strong>System Cache Resident Bytes</strong>:</em> the system’s file cache occupies a reserved range of virtual memory addresses, some of which may currently reside in RAM. (Cached file segments can also be non-resident, in which case they must be fetched from disk when they are referenced by executing processes.) <strong>System Cache Resident Bytes</strong> represents segments of the file cache that are currently resident in RAM.</p>
<p><em><strong>System Code Resident Bytes</strong>:</em> memory locations associated with system code that is currently resident in RAM.</p>
<p><em><strong>System Driver Resident Bytes</strong>:</em> memory locations associated with device driver code that is currently resident in RAM.</p>
<p>These five Counters account for RAM usage of virtual memory associated with operating system (and device driver) functions. As discussed above, <strong>Available Bytes</strong> represents free RAM that is not allocated to any OS function or to any executing process.</p>
<p>Once you know how much OS function are currently using, it ought to be a simple matter to account for RAM usage completely by factoring in the <strong>Working Set</strong> Bytes of various executing processes, as follows:</p>
<p><em>Process(_Total) Working Set Bytes = Sizeof(RAM) – (Available Bytes + Pool Nonpaged Bytes + Pool Paged Resident Bytes + System Cache Resident Bytes + System Code Resident Bytes + System Driver Resident Bytes)</em></p>
<p>However, resident pages associated with shared DLLs (e.g., DLLs like comsvcs.dll, mfc42.dll, msvbvm60.dll, etc.) are counted in each and every process Working Set that references a shared DLL. Because these resident pages are counted multiple times, Process(_Total) <strong>Working Set</strong> bytes usually reports a higher number of resident pages than are actually in use. In other words,</p>
<p><em>Sizeof(RAM) &lt; Process(_Total) Working Set Bytes + Available Bytes + Pool Nonpaged Bytes + Pool Paged Resident Bytes + System Cache Resident Bytes + System Code Resident Bytes + System Driver Resident Bytes</em></p>
<p>Because the numbers do not add up as they seemingly ought to, we prefer creating a report like Figure 1 above that charts the six system Memory counters (including Available Bytes) and compares their sum to the amount of installed RAM. Process working sets fill the amount of RAM left over after you have accounted for these six counters, even though you cannot pin down precisely which how much memory each process occupies.</p>
]]></content:encoded>
			<wfw:commentRss>http://faq.demandtech.com/2009/09/29/how-can-i-tell-how-much-ram-is-being-used-by-application-processes-and-various-operating-system-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I see a lot page faults on my system even though there appear to be plenty of Available Bytes. What is going on?</title>
		<link>http://faq.demandtech.com/2009/09/29/i-see-a-lot-page-faults-on-my-system-even-though-there-appear-to-be-plenty-of-available-bytes-what-is-going-on/</link>
		<comments>http://faq.demandtech.com/2009/09/29/i-see-a-lot-page-faults-on-my-system-even-though-there-appear-to-be-plenty-of-available-bytes-what-is-going-on/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 15:26:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Memory]]></category>
		<category><![CDATA[Windows Performance]]></category>

		<guid isPermaLink="false">http://faq.demandtech.com/?p=19</guid>
		<description><![CDATA[You are probably looking at the Page Faults/sec Counter and interpreting it as the rate of demand paging. Not entirely. In Windows Server, the Page Faults/sec counter includes both hard and soft page faults. (It also appears to include Cache faults/sec, which are application-related file cache read misses.) Instead of using the Page Faults/sec counter [...]]]></description>
			<content:encoded><![CDATA[<p style="margin: 0in 0in 6pt;">You are probably looking at the <strong>Page Faults/sec</strong> Counter and interpreting it as the rate of demand paging. Not entirely. In Windows Server, the <strong>Page Faults/sec</strong> counter includes both hard and soft page faults. (It also appears to include <strong>Cache faults/sec</strong>, which are application-related file cache read misses.) Instead of using the <strong>Page Faults/sec</strong> counter as an indicator of demand paging, you should rely on the <strong>Page Reads/sec</strong> Counter instead. <strong>Page Reads/sec</strong> corresponds to the rate of hard page faults that specifically require a disk access to resolve.</p>
<p style="margin: 0in 0in 6pt;">There are two types of so-called “soft” faults in Windows Server that are included in the <strong>Page Faults/sec</strong> metric: <strong>Transition Faults/sec</strong> and <strong>Demand Zero Faults/sec. </strong>High rates of both types of soft faults are common even where there is an ample supply of RAM.</p>
<p style="margin: 0in 0in 6pt;"><em>Transition faults</em><strong> </strong>are a by-product of the Window Server page replacement policy and cannot easily be avoided. To determine which pages of a process address space are not currently in use, the Windows Memory Manager trims pages aggressively from each process working set. These pages are only stolen by the operating system provisionally, however. Recently trimmed pages remain in memory on the Standby List. (The Standby List is one of the components of the pool of <strong>Available Bytes</strong>.) The idea is that the next time that threads from the process execute, they will reference the pages that identify the application’s current working set, which the Memory Manager will restore swiftly. Recently trimmed paged that are re-referenced <em>transition fault</em> back into the process working set quickly because they normally remain in memory for some period of time after being trimmed. Because these <em>transition faults</em> are resolved by the OS without ever having to retrieve a page from the paging file on disk, they are not nearly so costly as a hard page fault that must be resolved from disk.</p>
<p style="margin: 0in 0in 6pt;">The mechanism for handling transition faults is straightforward. Pages on the Standby List remain in memory. Their corresponding Page Table Entries (PTEs) are marked invalid, but are also flagged <em>in transition</em>. A process thread accessing a memory location on an invalid page triggers a hardware interrupt. During interrupt processing, the operating system quickly determines that a page in transition was referenced. The PTE entry for page is then quickly restored, the page is returned to the process working set, and the instruction that failed due to an invalid address reference is re-executed. Trimmed pages that are not re-referenced in a timely manner remain on the Standby List until they are eventually moved to the Free List and, finally, the Zero List as they age.</p>
<p style="margin: 0in 0in 6pt;"><em>Demand Zero faults</em> are requests from executing processes for new pages. For security reasons, the operating system always returns an empty, zero-filled page when a process requests a new page of virtual memory. Demand zero faults are satisfied with empty pages from the Zero List, or from the Free List if the Zero List is empty. The <strong>Demand Zero Faults/sec</strong> Counter corresponds to the rate of requests by processes for new zero-filled pages. Since requests for new pages are satisfied directly from the pool of Available Bytes, <strong>Demand Zero Faults/sec</strong> are another category of soft faults that do not require disk I/O to resolve.</p>
<p style="margin: 0in 0in 6pt;">Consider a server process that allocates an area of virtual memory as a work area when requests for service arrive and later frees the memory when it has finished processing the request. Since freeing memory replenishes the pool of <strong>Available Bytes</strong>, this process might generate a high rate of <strong>Demand Zero Faults/sec</strong> without ever needing to access the paging file on disk.</p>
<p style="margin: 0in 0in 6pt;">Because soft faults do not generate I/O to disk, it is important to ignore the rate of soft faults when you are trying to figure out if you have enough RAM.</p>
]]></content:encoded>
			<wfw:commentRss>http://faq.demandtech.com/2009/09/29/i-see-a-lot-page-faults-on-my-system-even-though-there-appear-to-be-plenty-of-available-bytes-what-is-going-on/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
