Condividi tramite


Chat Question: Memory Limits for 32-bit and 64-bit processes

During our recent blog chat, there were a number of topics that were asked about and I am going to expand on some of them.  The first one is the memory limits for different processes.

This really depends on a few different things.  The architecture of the process (32-bit or 64-bit) and also the architecture of the Operating System the process is running on.  For 32-bit it also depends if you use the /3GB switch or not.

So I broke this up based on these things into the table below, this is the maximum amount of memory available for the process assuming you have that much RAM and Pagefile space.

  32-bit OS 64-bit OS
32-bit process 2 GB 4 GB
32-bit process with /3GB 3 GB N/A
64-bit process N/A 16 TB

These process numbers are contingent on how much RAM and disk space you have, so if you have 4 GB of RAM and 4 GB Pagefile, the total memory of all running processes can’t be greater then 8 GB.

Note: If you let Windows manage your Pagefile size, when you hit this limit, Windows will try to grow your Pagefile as long as there is disk space available.

For the amount a .NET application will use before we can expect to see out of memory, those numbers are:

  32-bit OS 64-bit OS
32-bit process 800-1200 MB 2800 MB
32-bit process with /3GB 1800 MB N/A
64-bit process N/A 2800 MB if using a 4 GB process or more if more RAM (around 70% of RAM + Pagefile)

Keep in mind that although a .NET process can grow this large, if the process is multiple GB in size, it can become very difficult for the Garage Collector to keep up with the memory as Generation 2 will become very large.  I’ll talk about the generations more in an upcoming post.

Hopefully that will clear up how much memory each one uses.

Keep checking the RECAP- ASP.NET Blog Chat to see other topics that Tess or I write about.

kick it on DotNetKicks.com

Comments

  • Anonymous
    April 10, 2008
    You've been kicked (a good thing) - Trackback from DotNetKicks.com

  • Anonymous
    April 10, 2008
    Hi Tom, Why would there be a 4GB memory limitation for a 64-bit process on a 64-bit version of Windows? The virtual address space on current AMD64-bit architectures is 16TB, 8TB system space and 8TB user space. Sasha

  • Anonymous
    April 10, 2008
    Great post. Could you explain why .NET process is so much less capable in terms of memory allocation than ordinary Windows process?

  • Anonymous
    April 10, 2008
    Sasha, You are correct.  I have updated the post. Hope that clears it up.

  • Anonymous
    April 10, 2008
    The comment has been removed

  • Anonymous
    April 10, 2008
    Thanks to everyone that attended the chat we had today on Tess and my pages. I think it went really well

  • Anonymous
    April 10, 2008
    Hmnn, will be usefull . http://abmartin.wordpress.com

  • Anonymous
    April 11, 2008
    Tom,  let's assume that my app is perfect :), no pinned objects, no dynamic assembly problem, etc. Are you still saying that the app will get up to 1.2 GB? What happened to 0.8 GB that the native Windows process can allocate?

  • Anonymous
    April 11, 2008
    Yes.  So the reason is due to the way .NET allocated memory.  If you look at a process, you will have your loaded modules and then heap memory.  .NET always grows by a segment size.  So if you don't have that much contiguous memory available, you will get an OutOfMemoryException.  If you have something like a single page that just allocates in a loop, you can get up to 1.8 or 1.8 GB.  But in a real world application, because of where modules load, you tend to get much less.  Hope that helps clear it up.

  • Anonymous
    June 16, 2008
    The application needs to be modfied for using /3GB switch. http://www.microsoft.com/whdc/system/platform/server/PAE/PAEmem.mspx <snip> Executables that can use the 3-GB address space are required to have the bit IMAGE_FILE_LARGE_ADDRESS_AWARE set in their image header. If you are the developer of the executable, you can specify a linker flag (/LARGEADDRESSAWARE). To set this bit, you must use Microsoft Visual Studio Version 6.0 or later and the Editbin.exe utility, which has the ability to modify the image header (/LARGEADDRESSAWARE) flag. For more information on setting this flag, see the Microsoft Visual Studio documentation. </snip>

  • Anonymous
    October 16, 2008
    The comment has been removed

  • Anonymous
    October 17, 2008
    The comment has been removed

  • Anonymous
    January 11, 2009
    Hi, Andreas Fuchsberger here..... It is important to understand what happens CAT.NET builds its Call

  • Anonymous
    July 16, 2012
    Hi, thanks for the great article but I am running asp.net application and caching some DB tables. these datatables increases size of webdev.webserver40.exe while doing local debugging and when it reaches around 1,4 gb, i am getting system out of memory exception. my asp.net app is obviously 32 bit but OS is 64. based on your article, i supposed to have 2,8 gb approx. memory available for my process. Am I wrong? if yes, how to increase it? thanks.

  • Anonymous
    March 22, 2013
    64bit process on x64 system, 2800 MB if using a 4 GB process, What does the 4GB process mean here?

  • Anonymous
    July 17, 2013
    if you pysical and virtual less memory then u can add more memory add by additional memory or you can increase virtual memory

  • Anonymous
    July 25, 2013
    Ted, a 4 GB process is what you get unless your machine has more then 4 GB of physical RAM.