<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>“Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx</link><description>I started programming on x86 machines during a period of large and rapid change in the memory management strategies enabled by the Intel processors. The pain of having to know the difference between “extended memory” and “expanded memory” has faded with</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9709331</link><pubDate>Mon, 08 Jun 2009 23:40:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9709331</guid><dc:creator>Nick</dc:creator><description>&lt;P&gt;I'm sure this is a stupid question related to my not having a clear understanding of the differences between address space, virtual memory, etc, but then where does the 2GB memory allocation limit come into play?&lt;/P&gt;
&lt;DIV class=yellowbox&gt;
&lt;P&gt;There is no 2GB memory &lt;EM&gt;allocation&lt;/EM&gt; limit. You can &lt;EM&gt;allocate&lt;/EM&gt; as much memory as you want; you have 2GB of address space to &lt;EM&gt;map it into&lt;/EM&gt;. If you want to have 5GB allocated, great, you do that, but you only can have up to 2GB of it mapped at any one time. -- Eric&lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;For example, when many applications I use attempt to cross the ~2GB limit, they error or crash. &lt;/P&gt;
&lt;DIV class=yellowbox&gt;
&lt;P&gt;If your app author is unwilling to take on the pain of writing its own memory mapper/unmapper, then clearly it is stuck with not allocating more memory than it can map. -- Eric &lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;There's also the Windows limit of 2GB for user-mode applications (the /3GB switch stuff). &amp;nbsp;What you've said here makes sense, so should I assume that the only way to get access to more than 2GB of address space is to use alternative memory allocation techniques (LARGEADDRESSAWARE for example)?&lt;/P&gt;
&lt;DIV class=yellowbox&gt;
&lt;P&gt;Indeed. All the 3GB switch does is give you an extra GB of user address space by stealing it from the operating system's address space. That's the only way to get more address space in 32 bit windows. Again, you can allocate as much memory as you want, but address space is strictly limited to 2GB or 3GB in 32 bit windows. -- Eric &lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;It seems like your article ends right before a giant "BUT this is how it usually ends up working in real world applications" caveat.&lt;/P&gt;
&lt;DIV class=yellowbox&gt;
&lt;P&gt;In most apps, you can only allocate as much memory as you have room to map. -- Eric &lt;/P&gt;&lt;/DIV&gt;</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9709377</link><pubDate>Tue, 09 Jun 2009 00:08:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9709377</guid><dc:creator>Erik</dc:creator><description>&lt;p&gt;Great article, thanks! :)&lt;/p&gt;
&lt;p&gt;I would like to see a 'back-in-the-day' type article regarding Extended &amp;amp; Expanded memory, just for a history lesson - I never could get the hang of it back then...&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9709499</link><pubDate>Tue, 09 Jun 2009 00:36:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9709499</guid><dc:creator>Delmania</dc:creator><description>&lt;p&gt;Excellent article, and I think your view of memory as large file on disk with the RAM being an optimization makes a lot more sense! &amp;nbsp;&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9710519</link><pubDate>Tue, 09 Jun 2009 01:35:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9710519</guid><dc:creator>commongenius</dc:creator><description>&lt;p&gt;I agree that thinking of RAM as a performance optimization makes the whole concept more straightforward. The CPU cache(s), the physical memory, and the virtual memory swap file are really just different levels of a multi-level cache, each level begin larger but slower than the level before.&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9710670</link><pubDate>Tue, 09 Jun 2009 01:42:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9710670</guid><dc:creator>Harry S.</dc:creator><description>&lt;p&gt;We don't think about the system cache as being a device that swaps out to RAM when it gets too full, so it does make a lot of sense to think about memory as being a disk file and RAM just an optimization detail. Great article.&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9710814</link><pubDate>Tue, 09 Jun 2009 01:49:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9710814</guid><dc:creator>Jonathan</dc:creator><description>&lt;p&gt;Physics nitpick:&lt;/p&gt;
&lt;p&gt;The electrons in a circuit only travel a few miles per hour, it is their displacement wave that travels near the speed of light.&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9710883</link><pubDate>Tue, 09 Jun 2009 02:08:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9710883</guid><dc:creator>Blake Coverett</dc:creator><description>&lt;p&gt;To follow up on Erik's wish (because I doubt it really has enough meat for a whole article from Eric) on Extended vs Expanded memory:&lt;/p&gt;
&lt;p&gt;Extended Memory is what we think of as memory now, i.e. memory that is addressed further and further up from physical address 0 by using more and more of the address bus lines from the CPU. &amp;nbsp; In the DOS days accessing this memory required magic, because DOS, and hence DOS apps, ran in &amp;quot;real mode&amp;quot; where the segment registers and offset registers were each 16 bits wide, and combined with a simple 4 bit shift and add to give a 20 bit physical address. &amp;nbsp; Ignoring the HMA for a moment, to access beyond 2^20, i.e. 1MB, the CPU had to be switched to one of the protected modes, where the segment register treated as an index into a table of segment base addresses. &amp;nbsp;This was the core of Win16's memory model.&lt;/p&gt;
&lt;p&gt;Expanded Memory was, from the CPU's perspective, a device that happened to have RAM on it, not 'memory' at all. &amp;nbsp;A portion of the reserved address space between 640K and 1024K, where other memory mapped devices like your VGA card, was used to map in pages of memory from that device. &amp;nbsp; Once a page was mapped in, a real mode app could read or write it just like they'd read or write the VGA screen buffer's memory. &amp;nbsp; An interrupt based API was used to change what page of expanded memory was mapped into that buffer. &amp;nbsp;The closest we have to this more recently would be PAE, which like Expanded Memory is an nasty stopgap that's only used by a small fraction of apps.&lt;/p&gt;
&lt;p&gt;For bonus points, that High Memory Area I mentioned was the first 64K past 1024K, that could be accessed from real mode. &amp;nbsp;On a real 8086 (which real mode mimics) if the sum of the segment register shifted over 4 and the offset was greater than 2^20 it just wrapped, after all there were only 20 address lines. &amp;nbsp;On a 286 or later you could choose whether it should wrap, or whether it should overflow into the 21's address line, giving you access to that extra little bit of memory. &amp;nbsp; DOS quickly learned to tuck as much of itself as possible into that HMA, reducing the footprint it required in the bottom 640K where most apps were limited.&lt;/p&gt;
&lt;p&gt;Okay, so it was a bit longer than I realized when I started rambling, even leaving out many details.&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9710886</link><pubDate>Tue, 09 Jun 2009 02:09:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9710886</guid><dc:creator>N&amp;#233;stor S&amp;#225;nchez</dc:creator><description>&lt;P&gt;And about .NET development...&lt;/P&gt;
&lt;P&gt;If I need to access many GBs of data... the CLR is intelligent enough to do it for me?&lt;/P&gt;
&lt;P&gt;or... I must to write my own memory mapper to deal with the issue? and how?&lt;/P&gt;
&lt;DIV class=yellowbox&gt;
&lt;P&gt;On 64 bit CLR, you're all set.&amp;nbsp;On 32 bit CLR, if you need to do custom mapping and unmapping of huge blocks of memory, then I personally would not want to handle that in managed code. There are ways to do it, of course, but it would not be pretty. -- Eric&lt;/P&gt;&lt;/DIV&gt;</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9710943</link><pubDate>Tue, 09 Jun 2009 02:43:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9710943</guid><dc:creator>configurator</dc:creator><description>&lt;p&gt;This comment is by no means a tutorial on tutorials.&lt;/p&gt;
&lt;p&gt;I find that posts that begin with such wording are usually the best tutorials available. This blog post is a great example of that. Previously, while I knew about these differences, I had to think to keep them in mind. Now, Eric has transformed that thought process into a state of mind. Yeah, memory is a file; it's cached in the RAM for performance. It truly makes perfect sense.&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9711315</link><pubDate>Tue, 09 Jun 2009 03:27:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9711315</guid><dc:creator>ShuggyCoUk</dc:creator><description>&lt;p&gt;note on CLR, the CLR's memory constructs under the hood prevent any object (say an array or string) being more than 2GB in size so whilst you *could* write code to deal with greater than 2GB address space (which would be incredibly painful) you would still get an OOM exception i you tried to allocate new long[int.MaxValue] no matter what.&lt;/p&gt;
&lt;p&gt;the nicer the box feels to be in the harder it is to jump out of it.&lt;/p&gt;
&lt;p&gt;I like soft boxes iwht padding :)&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9711327</link><pubDate>Tue, 09 Jun 2009 03:38:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9711327</guid><dc:creator>Simon Buchan</dc:creator><description>&lt;p&gt;A nitpick: considering RAM as a cache for the disk is not *quite* correct, since the manager can choose to never write a page in RAM to disk (although I believe it ensures there is enough storage in the page file just in case).&lt;/p&gt;
&lt;p&gt;I just think of the combination of RAM and disk as the &amp;quot;physical memory&amp;quot; (or just &amp;quot;backing&amp;quot; to reduce confusion with RAM), where the manager tries to keep the often used stuff in the fast part of the memory.&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9711437</link><pubDate>Tue, 09 Jun 2009 04:38:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9711437</guid><dc:creator>Erik</dc:creator><description>&lt;p&gt;@Blake Coverett - Thanks a bunch for the intro =) You're probably right about there not being enough meat for a full-blown article - but still, very interesting information nonetheless.&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9712689</link><pubDate>Tue, 09 Jun 2009 08:26:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9712689</guid><dc:creator>Mark</dc:creator><description>&lt;p&gt;Simon Buchan: but that's just an optimisation applied to many caches. &amp;nbsp;If the cached range never needs to touch the slow medium during its lifetime, there's not point doing so. &amp;nbsp;Just as when you &amp;quot;allocate&amp;quot; a variable for a calcuation, it might get optimised away.&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9712711</link><pubDate>Tue, 09 Jun 2009 08:43:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9712711</guid><dc:creator>Simon Buchan</dc:creator><description>&lt;p&gt;@Mark: Perhaps we have different definitions of &amp;quot;cache&amp;quot; then... I've always thought of it as being a copy of the authoritative value made for performance reasons. It's just the word though, this is getting super-nitpicky. (That is too a word, Safari!)&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9713701</link><pubDate>Tue, 09 Jun 2009 10:46:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9713701</guid><dc:creator>Jorge</dc:creator><description>&lt;P&gt;"There is no 2GB memory allocation limit. You can allocate as much memory as you want; you have 2GB of address space to map it into." &lt;/P&gt;
&lt;P&gt;What's the use? I can't have more than 2GB allocated AT THE SAME TIME.&lt;/P&gt;
&lt;DIV class=yellowbox&gt;
&lt;P&gt;The use case of memory is typically that you want to &lt;EM&gt;remember&lt;/EM&gt; something. Perhaps you have&amp;nbsp;four billion bytes of video that you are processing, and you want to keep the whole video in memory. You could map the bits you're currently editing into virtual memory while leaving the rest unmapped until you're done with what you've got.&amp;nbsp;-- Eric&lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;Out of memory can be raised because there's not enough virtual space free. The limit is the memory you can address not the memory you can map. If I allocate three 1 GB byte arrays it will probably fail with an out of memory error because I simple do not have enough memory to address the virtual address of the last one.&lt;/P&gt;</description></item><item><title>The strange case of Visual Studio getting "out of memory"</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9714464</link><pubDate>Tue, 09 Jun 2009 11:53:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9714464</guid><dc:creator>Carlos Quintero (Microsoft MVP) blog</dc:creator><description>&lt;p&gt;I started programming in the old times of 16-bit MS-DOS, where you had only 640 KB of memory, and you&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9714478</link><pubDate>Tue, 09 Jun 2009 12:03:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9714478</guid><dc:creator>Anthony Jones</dc:creator><description>&lt;p&gt;I agree with your conceptualisation. &amp;nbsp;Its the way I've prefered to look at it ever since coding on VAX/VMS systems from which NT inherited these concepts via David Cutler.&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9714621</link><pubDate>Tue, 09 Jun 2009 13:37:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9714621</guid><dc:creator>Pop Catalin</dc:creator><description>&lt;p&gt;Actually why is the hard disk size the limit of how much you could allocate? Why doesn't windows go to the cloud for more space ? And then the limit is the total amount of free space available on the internet ..... which is allot.&lt;/p&gt;
&lt;p&gt;But of course if you go to the cloud with the allocation scheme, you need some URI scheme to reference your allocated space: pointer -&amp;gt; Uri translation.&lt;/p&gt;
&lt;p&gt;And then you could think your PC is just a Cache for data allocated on the cloud/internet ;-).&lt;/p&gt;
&lt;p&gt;P.S. This was meant as a joke :), obviously &lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9715942</link><pubDate>Tue, 09 Jun 2009 15:54:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9715942</guid><dc:creator>Bob</dc:creator><description>&lt;p&gt;Erik,&lt;/p&gt;
&lt;p&gt;So your cross to bear was expanded/extended memory. Mine was overlay description files on the PDP-11.&lt;/p&gt;
&lt;p&gt;As Anthony Jones said, your description brought back memories of VAX/VMS, which in the early days suffered from the high cost of RAM, making thrashing a not-so-theoretical problem. It was not uncommon to encounter VAX systems with 512KB of RAM.&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9716026</link><pubDate>Tue, 09 Jun 2009 16:36:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9716026</guid><dc:creator>TheCPUWizard</dc:creator><description>&lt;p&gt;Bob,&lt;/p&gt;
&lt;p&gt;I remember RSX-11/M ODL files well (along with RT-11 means of dealing with the same memory management issues). In fact I still have a couple of working PDP-11's (primarily Q-BUS), and a working PDP-8. &lt;/p&gt;
&lt;p&gt;Now that was some real fun memory management. MAX 4KW of Code and 4KW of Data. And the mapping unit was also 4KW (which meant that when you changed mapping you immediately lost your current context &amp;lt;eek&amp;gt;).&lt;/p&gt;
&lt;p&gt;[People interested in the &amp;quot;classics&amp;quot; can contact me via: &amp;nbsp;david dot corbin at dynconcepts dot com&lt;/p&gt;
</description></item><item><title>Interesting Finds: June 9, 2009</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9716108</link><pubDate>Tue, 09 Jun 2009 17:21:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9716108</guid><dc:creator>Jason Haley</dc:creator><description>&lt;p&gt;Interesting Finds: June 9, 2009&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9716186</link><pubDate>Tue, 09 Jun 2009 17:48:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9716186</guid><dc:creator>halpierson</dc:creator><description>&lt;p&gt;Mapping data files into your address space is another way of using your process space. &amp;nbsp;It's more efficient than buffered access, that has to copy data into you process space buffers.&lt;/p&gt;
&lt;p&gt;Can you map files in .NET?&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9716634</link><pubDate>Tue, 09 Jun 2009 20:19:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9716634</guid><dc:creator>Joren</dc:creator><description>&lt;p&gt;@halpierson&lt;/p&gt;
&lt;p&gt;There is a new namespace in .NET 4.0 that allows for memory mapped files:&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://msdn.microsoft.com/en-us/library/system.io.memorymappedfiles"&gt;http://msdn.microsoft.com/en-us/library/system.io.memorymappedfiles&lt;/a&gt;(VS.100).aspx&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9717365</link><pubDate>Tue, 09 Jun 2009 21:56:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9717365</guid><dc:creator>James</dc:creator><description>&lt;p&gt;Lovely post, thanks! &amp;nbsp;Of course, electrons flowing through conductors in the form of electricity actually move at significantly slower speeds than even your miata. &amp;nbsp;The conductor just happens to always be full of electrons, making the signal propagate at that speed. &amp;nbsp;Think of a hose full of water. &amp;nbsp;Turn on the faucet and water comes out immediately. &amp;nbsp;That doesn't mean the water is moving at the speed of light, just that the hose was full of water.&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9718385</link><pubDate>Tue, 09 Jun 2009 23:23:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9718385</guid><dc:creator>TheCPUWizard</dc:creator><description>&lt;P&gt;The actual flow rate of electrons can be VERY VERY slow....Even the wave propogation is significantly slower in a non-vacuum environment.&lt;/P&gt;
&lt;P&gt;I remember well laying out circuit boards and measuring trace lengths to determine propogation delay (and the fact that a signal would arrive at two different points in the circuit at different times).&lt;/P&gt;
&lt;P&gt;IIRC: the normal number we used for copper PCB's was 1.5nS per FOOT.....&lt;/P&gt;
&lt;DIV class=yellowbox&gt;
&lt;P&gt;Indeed, Grace Hopper used to hand out a foot of phone wire when she'd give talks. She'd use the foot of wire to illustrate the concept of a nanosecond. -- Eric&lt;/P&gt;&lt;/DIV&gt;</description></item><item><title>Community Convergence XLIX (IL)</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9718422</link><pubDate>Tue, 09 Jun 2009 23:45:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9718422</guid><dc:creator>Charlie Calvert's Community Blog</dc:creator><description>&lt;p&gt;Welcome to the 49th edition of Community Convergence. The big excitment of late has been the recent release&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9723567</link><pubDate>Wed, 10 Jun 2009 10:26:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9723567</guid><dc:creator>Samin</dc:creator><description>&lt;p&gt;&amp;quot;Accessing data in RAM, where the information is stored in tiny, lightweight electrons that move at close to the speed of light is much faster than accessing data on disk, where information is stored in enormous, heavy iron oxide molecules that move at close to the speed of my Miata.&amp;quot;&lt;/p&gt;
&lt;p&gt;-- made my day :)&lt;/p&gt;
&lt;p&gt;great article, I have to admit that I was one of those “I got an ‘out of memory’ error but I checked and the machine has plenty of RAM, what’s up with that?”. Shame on me. But now I know better.&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9723631</link><pubDate>Wed, 10 Jun 2009 11:08:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9723631</guid><dc:creator>hyperspaced</dc:creator><description>&lt;P&gt;I can't seem to fully understand your view of the memory management regarding storage file as being the primary level of memory and RAM as an optimization&lt;/P&gt;
&lt;P&gt;Let's assume a process is started and requires memory. What's the primary memory source? The storage file and *then* the OS copies the memory to RAM? &lt;/P&gt;
&lt;DIV class=yellowbox&gt;
&lt;P&gt;Please carefully re-read the sixth paragraph. -- Eric&lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;Let's assume I have 6GB of RAM and only 2GB of storage file (in contradiction to MS recommendations) What happens there? &lt;/P&gt;
&lt;DIV class=yellowbox&gt;
&lt;P&gt;Probably nothing pleasant. -- Eric&lt;/P&gt;&lt;/DIV&gt;</description></item><item><title>“Недостаточно Памяти” не относится к физической памяти</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9723966</link><pubDate>Wed, 10 Jun 2009 14:32:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9723966</guid><dc:creator>Невероятные приключения в коде (перевод блога Эрика Липперта)</dc:creator><description>&lt;p&gt;Я начал программировать на x86 машинах во время периода значительных и быстрых изменений в стратегиях&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9724225</link><pubDate>Wed, 10 Jun 2009 16:56:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9724225</guid><dc:creator>Daniel Earwicker</dc:creator><description>&lt;p&gt;Simon Buchan said: A nitpick: considering RAM as a cache for the disk is not *quite* correct, since the manager can choose to never write a page in RAM to disk (although I believe it ensures there is enough storage in the page file just in case).&lt;/p&gt;
&lt;p&gt;The file system's in-memory cache can make the same decision, especially if you tell CreateFile that a file is &amp;quot;temporary&amp;quot; and then you delete it quickly. It may never get written to the disk at all, but only ever exist in memory. And yet we still call it the &amp;quot;disk cache&amp;quot;! The reality (in both VM and disk caching) is that we have *some* stuff in memory, and *some* stuff on disk, and there's *some* overlap between the two, and that's about all we can say in general.&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9725813</link><pubDate>Thu, 11 Jun 2009 08:11:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9725813</guid><dc:creator>Eddie</dc:creator><description>&lt;p&gt;&amp;gt;&amp;gt;For example, when many applications I use attempt to cross the ~2GB limit, they error or crash.&lt;/p&gt;
&lt;p&gt;&amp;gt;If your app author is unwilling to take on the pain of writing its own memory mapper/unmapper, then clearly it is stuck with not allocating more memory than it can map. -- Eric&lt;/p&gt;
&lt;p&gt;Which is it? Your main article appeared to say 'It Just Works' but this response seems to contradict that earlier statement.&lt;/p&gt;
&lt;p&gt;It's always been my experience that if you're going to work with very very large amounts of data, you have to be able to process them without needing it all in memory at the same time. When you hit that stage, you're working with files on disk from the start.&lt;/p&gt;
&lt;p&gt;It's the same idea as iterating over an enumerator. You don't always want always assume you can Count() or ToList() it because what happens if it's streaming data?&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9725907</link><pubDate>Thu, 11 Jun 2009 09:03:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9725907</guid><dc:creator>Bruce Pierson</dc:creator><description>&lt;p&gt;&amp;quot;Accessing data in RAM, where the information is stored in tiny, lightweight electrons that move at close to the speed of light is much faster than accessing data on disk, where information is stored in enormous, heavy iron oxide molecules that move at close to the speed of my Miata.&amp;quot;&lt;/p&gt;
&lt;p&gt;Ha, this was great. But speaking as an old hard-disk guy, iron oxide is almost as outdated as expanded/extended memory. Your new shiny computer probably uses cobalt thin film media rather than rust on its disk platters. So maybe more like your Ferrari (come on, we know you have one)?&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9726000</link><pubDate>Thu, 11 Jun 2009 09:53:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9726000</guid><dc:creator>Gokhank KORALTURK</dc:creator><description>&lt;p&gt;Well, in my case, i sometimes prefer to disable paging file, thus removing &lt;/p&gt;
&lt;p&gt;1. the cost of unnecessary disk io&lt;/p&gt;
&lt;p&gt;2. the chance of allocating memory more than what i have as RAM.&lt;/p&gt;
&lt;p&gt;All in all, if i don't need too much memory on my laptop (i have 4GB of RAM and it's almost always enough) this method reduces the I/O and also helps to keep myalways moving laptop's harddrive physicaly safer (less IO less chance of bad sectors)&lt;/p&gt;
&lt;p&gt;In this case, there is no use for page faults, and it's a happy system as long as you don't need big chunks of memory. And trust me, it boosts the performance since Windows DOES paging even if everything fits in RAM, but unable to do so with this method.&lt;/p&gt;
</description></item><item><title>“Out Of Memory” Does Not Refer to Physical Memory - Eric Lippert</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9726456</link><pubDate>Thu, 11 Jun 2009 15:12:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9726456</guid><dc:creator>DotNetShoutout</dc:creator><description>&lt;p&gt;Thank you for submitting this cool story - Trackback from DotNetShoutout&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9726684</link><pubDate>Thu, 11 Jun 2009 17:42:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9726684</guid><dc:creator>Jim</dc:creator><description>&lt;P&gt;"The amount of data storage reserved for a process is only limited by the amount of space that the operating system can get on the disk."&lt;/P&gt;
&lt;P&gt;"RAM can be seen as merely a performance optimization."&lt;/P&gt;
&lt;P&gt;This is not always correct because windows can operate without a paging file. And if you have a lot of ram (which btw is very cheap these days) you should kill the paging file.&lt;/P&gt;
&lt;DIV class=yellowbox&gt;
&lt;P&gt;Indeed. Re-read the sixth paragraph. -- Eric&lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;I have 3 computers at home (3GB, 3GB and 8GB) and 2 at work (4GB and 16GB) and none of them uses a paging file. Having a paging file makes sense if you don't have a lot of memory but nowadays it less and less useful. 2GB of DDR2 can be bought for $30 or less. Buy RAM and kill the paging file and do not think of ram as data in a file on disk.&lt;/P&gt;</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9726767</link><pubDate>Thu, 11 Jun 2009 18:26:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9726767</guid><dc:creator>Vrv</dc:creator><description>&lt;p&gt;Cool. Reminded me of my operating systems classes in college. A brief explanation of the dining philosophers problem would have been excellent.&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9731700</link><pubDate>Fri, 12 Jun 2009 11:27:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9731700</guid><dc:creator>Gab EL-D</dc:creator><description>&lt;P&gt;Started programming in the 32-bit systems (x86). I think it makes a lot of sense, although i work mostly with managed code. It explains why an app running on a system with almost 4GB of ram and free disk space of 20GB, throws an out of memory exception when it ram usage bearly 1.5GB (after running for long hours).&lt;/P&gt;
&lt;P&gt;And it is the only major app running on the system.&lt;/P&gt;
&lt;P&gt;What do you suggest will solve the problem? (Leaving mapping/unmapping memory aside, as it is managed code).&lt;/P&gt;
&lt;DIV class=yellowbox&gt;
&lt;P&gt;My suggestion: use the CLR memory profiler to figure out why you are using so much memory. If you have a memory leak, fix it. If you don't, figure out what the largest consumer of memory is, and optimize it so that it doesn't consume so much memory. -- Eric&lt;/P&gt;&lt;/DIV&gt;</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9787199</link><pubDate>Fri, 19 Jun 2009 15:39:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9787199</guid><dc:creator>Loddie</dc:creator><description>&lt;p&gt;in all of this, I'm curious. &amp;nbsp;What does this set of memory guru's recommend as a swap file setting? &amp;nbsp;Is it Swap File = RAM or Swap File = RAM * 1.5 (or some other setting)? &amp;nbsp;Or, do you really recommend letting Windows manage the swap file size? &amp;nbsp;I'd heard (long ago) that this just eats up system resources letting Windows manage it and I've always opted to just set it to 1.5 times the RAM.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9787706</link><pubDate>Fri, 19 Jun 2009 17:00:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9787706</guid><dc:creator>Bob Beasley</dc:creator><description>&lt;p&gt;To dive deeper into this article I need to know if you race your Miata? If yes, autocross or road race? &lt;/p&gt;
&lt;p&gt;Seriously, thank you for the article!&lt;/p&gt;
&lt;p&gt;Bob&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9801504</link><pubDate>Wed, 24 Jun 2009 16:56:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9801504</guid><dc:creator>Mike</dc:creator><description>&lt;P&gt;Excellent arcticle. &amp;nbsp;One question. &amp;nbsp;I have a website that relies heavily on caching to reduce database access. &amp;nbsp;About once a day I start to receive OutOfMemory exceptions and the worker process recycles itself. &amp;nbsp;Would you recommend upgrading RAM ( Currently 4GB ) or the OS to 64 bit?&lt;/P&gt;
&lt;DIV class=yellowbox&gt;
&lt;P&gt;Better than either of those strategies would be to &lt;EM&gt;fix the actual bug&lt;/EM&gt;, which is that the caching logic leaks memory. If the cache is growing without bound and eventually filling up all of memory, giving it more room to grow is just making the problem worse, not better. -- Eric&lt;/P&gt;&lt;/DIV&gt;</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9816856</link><pubDate>Fri, 03 Jul 2009 18:53:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9816856</guid><dc:creator>LegacyOfHerot</dc:creator><description>&lt;p&gt;I'm sure this won't be a popular question: I have a number of boxes running XP, and have been for years. I used to be able to run dozens of applications at the same time. Now, after the past few service packs, I've noticed that GIVEN THE SAME INSTALLATIONS, AND THE SAME HARDWARE I cannot run nearly as many applications at the same time. A number of colleagues have noticed similar issues. Its almost as though something has been pushed out in a service pack to peg the number of concurrent apps, or limit memory in some way. Of course this might encourage some to &amp;quot;upgrade&amp;quot; to x64, but given the number of everyday apps that dont install / run on x64 that is not an option. Just to re-iterate - this is not the gradual slowing down of performance we have all come to expect, this has been a distinct change over the past few packs, on several machines. Any thoughts?&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9845410</link><pubDate>Thu, 23 Jul 2009 02:16:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9845410</guid><dc:creator>seo</dc:creator><description>&lt;p&gt;Reminded me of my operating systems classes in Uni&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9871036</link><pubDate>Sat, 15 Aug 2009 16:18:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9871036</guid><dc:creator>Tom</dc:creator><description>&lt;p&gt;I do like this article quite a bit, and the concept of treating RAM as a disk cache is refreshing. &amp;nbsp;Of course, you did neglect to acknowledge memory allocations that neither (a) mirror data on disk or (b) are ever intended to reach the disk. &amp;nbsp;I'm thinking mainly of the application stack, but also of temporary allocations used for decompressing data, and other such transitive operations. &amp;nbsp;Perhaps it's best to ignore these exceptions for sanity's sake!&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9885283</link><pubDate>Wed, 26 Aug 2009 16:20:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9885283</guid><dc:creator>Mike Dimmick</dc:creator><description>&lt;p&gt;Loddie, the OS already uses the 1.5 x RAM rule for the minimum when there is less than 2GB fitted or 1 x RAM for more than 2GB. The maximum is 3 x RAM in both cases. At least, that's my recollection, I don't have my copy of Windows Internals 5th Edition to hand right now.&lt;/p&gt;
&lt;p&gt;There really is no right setting for the swap file. In Task Manager, before Windows Vista, Commit Charge Peak shows the maximum amount of the swap file that has been used (actually physical + swap file) since the system was booted. Limit is the current maximum possible commit. ('Commit Charge' - you 'commit' virtual memory to make it usable, 'reserve' just stops anything else from using that address range, but you get access violation exceptions if you try to reference reserved, but not committed, memory. The process is 'charged' for memory it commits, so 'commit charge' is the total memory committed by all processes.)&lt;/p&gt;
&lt;p&gt;Windows Vista rather more sensibly shows the actual page file usage. Commit Charge Peak isn't shown.&lt;/p&gt;
</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9920309</link><pubDate>Tue, 10 Nov 2009 18:06:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9920309</guid><dc:creator>Alex K</dc:creator><description>&lt;P&gt;While horribly late to the party (way beyond fashionable), I'd still like to ask a question.&lt;/P&gt;
&lt;P&gt;What do I do if this "out of memory" error happens in the managed app running under CLR? I don't get direct access to any memory/pages. So while the problem is clear to me after reading this article, I am in complete darkness as to what should I do about it.&lt;/P&gt;
&lt;DIV class=yellowbox&gt;
&lt;P&gt;Rewrite the program to not use so much memory per process. Or, less good, tell the user to stop throwing problems at the program that require so much memory. -- Eric&lt;/P&gt;&lt;/DIV&gt;</description></item><item><title>re: “Out Of Memory” Does Not Refer to Physical Memory</title><link>http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx#9937529</link><pubDate>Wed, 16 Dec 2009 09:15:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9937529</guid><dc:creator>Mohit Jain</dc:creator><description>&lt;p&gt;Very nice article, explains the concept of a win32's process memory/address space in a very simple way.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
</description></item></channel></rss>