.NET's OutofMemory exception and large memory usage

zhaozj2021-02-12  158

From last year, our server occasionally throws OutofMemoryException, that is, there is not enough memory to continue to execute an exception that is raised. This problem will still occur if the server memory is added to 4G. Software is a third-party simulator for UO. In fact, from the task manager, you can see that the software takes up about 1 g of memory, of course, because of the GC, there is about 600M in the actual software. To avoid more than 1G multi-memory occupation, and throw OutofMemory exception, setting the mandatory GC when the memory occupies a certain value, and a bit can lose a few hundred megabytes, but it is not completely solved. Recently, foreign forums posted relevant processing methods, and turned over, I hope to help friends who meet similar problems.

For 2G memory servers, .NET can only use 1.2G memory. For a 4G memory server, .NET can use 2.4G memory. However, the system needs to be set as follows: 1, add / 3GB switches in the boot.ini file. [boot loader] Timeout = 30DEFAULT = MULTI (0) Disk (0) Rdisk (0) Partition (2) / Winnt [Operating Systems] Multi (0) Disk (0) RDisk (0) Partition (2) / Winnt = " ???? "" / 3GB2, in the command line window, enter the directory, such as CD "C: / Program Files / Microsoft Visual Studio .NET 2003 / VC7 / BIN" 3, run the link command: link -edit -lageaddressaware server. EXE (Server.exe is your .NET program) 4, your server.exe can use 2.4G memory

.NET 1.2 does not solve this problem, the new 2.0 has not been tested, I don't know if 2.0 has no big changes in memory management and GC performance.

转载请注明原文地址:https://www.9cbs.com/read-6928.html

New Post(0)