简体   繁体   English

.net应用程序抛出内存不足异常

[英].net application throw outofmemory exception

I have two windows server 2003 has 8GB and 16GB RAM. 我有两个Windows Server 2003,分别具有8GB和16GB RAM。

when run a test program on the servers, all of them throws OutOfMemory Exception, when the heap size of test program reached at 738Mb. 在服务器上运行测试程序时,当测试程序的堆大小达到738Mb时,它们都将抛出OutOfMemory Exception。

I have search that windows server will just using 60% of 2Gb User memory address, it might be 1.2Gb. 我已经搜索到Windows服务器将仅使用2Gb用户内存地址的60%,可能是1.2Gb。

so, 所以,
1. which machine target decide the max memory? 1.哪个机器目标决定最大内存?
2. why 8Gb and 16Gb server show the same performance? 2.为什么8Gb和16Gb服务器显示相同的性能?
3. Some document said 1.2Gb(about) depends on Private Bytes or Working Set or Virtual Bytes Or the heap size? 3.一些文档说1.2Gb(大约)取决于专用字节或工作集或虚拟字节,还是堆大小?

I'm not sure I understand all your questions, but I recommend you read this article . 我不确定我是否理解您的所有问题,但建议您阅读本文 Some key points: 一些关键点:

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. 为进程保留的数据存储量仅受操作系统可以在磁盘上获得的空间量限制。 (*) (*)

An “out of memory” error almost never happens because there's not enough storage available; 因为没有足够的可用存储空间,几乎不会发生“内存不足”错误。 as we've seen, storage is disk space, and disks are huge these days. 如我们所见,存储是磁盘空间,而这些天磁盘又很大。 Rather, an “out of memory” error happens because the process is unable to find a large enough section of contiguous unused pages in its virtual address space to do the requested mapping. 而是发生“内存不足”错误,因为该进程无法在其虚拟地址空间中找到足够大的连续未使用页面部分来执行请求的映射。

it should be clear why “out of memory” errors usually have nothing to do with how much physical memory you have, or how even how much storage is available. 应该清楚为什么“内存不足”错误通常与您有多少物理内存或什至有多少可用存储空间无关。 It's almost always about the address space, which on 32 bit Windows is relatively small and easily fragmented. 它几乎总是与地址空间有关,在32位Windows上,该地址空间相对较小并且很容易分散。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM