Maximum .NET achievable memory?

后端 未结 9 1698
日久生厌
日久生厌 2020-12-09 04:36

Which is the maximum amount of memory one can achieve in .NET managed code? Does it depend on the actual architecture (32/64 bits)?

相关标签:
9条回答
  • 2020-12-09 05:24

    The amount of memory your .NET process can address depends both on whether it is running on a 32/64 bit machine and whether or not it it running as a CPU agnostic or CPU specific process.

    By default a .NET process is CPU agnostic so it will run with the process type that is natural to the version of Windows. In 64 bit it will be a 64 bit process, and in 32 bit it will be a 32 bit process. You can force a .NET process though to target a particular CPU and say make it run as a 32 bit process on a 64 bit machine.

    If you exclude the large address aware setting, the following are the various breakdowns

    • 32 bit process can address 2GB
    • 64 bit process can address 8TB

    Here is a link to the full breakdown of addressable space based on the various options Windows provides.

    http://msdn.microsoft.com/en-us/library/aa366778.aspx

    0 讨论(0)
  • 2020-12-09 05:29

    For 64 bit Windows the virtual memory size is 16 TB divided equally between user and kernel mode, so user processes can address 8 TB (8192 GB). That is less than the entire 16 EB space addressable by 64 bits, but it is still a whole lot more than what we're used to with 32 bits.

    0 讨论(0)
  • 2020-12-09 05:31

    The .NET runtime can allocate all the free memory available for user-mode programs in its host. Mind that it doesn't mean that all of that memory will be dedicated to your program, as some (relatively small) portions will be dedicated to internal CLR data structures. In 32 bit systems, assuming a 4GB or more setup (even if PAE is enabled), you should be able to get at the very most roughly 2GB allocated to your application. On 64 bit systems you should be able to get 1TB. For more information concerning windows memory limits, please review this page. Every figure mentioned there has to be divided by 2, as windows reserves the higher half of the address space for usage by code running in kernel mode (ring 0). Also, please mind that whenever for a 32 bit system the limit exceeds 4GB, use of PAE is implied, and thus you still can't really exceed the 2GB limit unless the OS supports 4gt, in which case you can reach up to 3GB.

    0 讨论(0)
提交回复
热议问题