简体   繁体   English

ASP.Net应用程序池使用太多内存

[英]ASP.Net application pool use too much memory

I create asp.net asmx service for online game. 我为在线游戏创建了asp.net asmx服务。 When it run on production server asp.net application use 1.5 - 3 GB of memory. 当它在生产服务器asp.net应用程序上运行时,使用1.5-3 GB的内存。

When i use ANTS memory profiler, i saw what 70% of application memory is free and C# objects use 100 - 200Mb. 当我使用ANTS内存探查器时,我看到70%的应用程序内存可用,而C#对象使用100-200Mb。

How me make asp.net return free memory to OS? 我如何使asp.net将可用内存返回给OS? If i will run several similar apllication on one server i get memory out exception. 如果我将在一台服务器上运行几个类似的应用程序,我会得到内存不足的异常。

Used technologes: ASP.Net v4 Windows 2008 C# Small used asp.net cashe for hard database request. 二手技术:ASP.Net v4 Windows 2008 C#小型asp.net Cashe,用于硬数据库请求。

Unfortunately this is possible. 不幸的是,这是可能的。 As you may know CLR uses 2 kind of reference objects in heap, Standard and Large objects Heap. 如您所知,CLR在堆中使用2种参考对象,即标准对象和大型对象堆。 Standard objects heap is defragmented after a garbage collector, but large one isn't, as CLR team decided that it would cause performance issues. 标准对象堆在垃圾收集器之后进行了碎片整理,但大型对象却没有,因为CLR团队认为这会导致性能问题。 That's why LOH can consume to much memory during usage. 这就是为什么LOH在使用过程中会消耗大量内存的原因。

Objects that are larger than >85000 Bytes are allocated in LOH, so my advice is to analyze your code to find objects that can be allocated in LOH, and try to make them smaller. 大于85000字节的对象在LOH中分配,因此我的建议是分析您的代码以查找可以在LOH中分配的对象,并尝试使其变小。

Hope this will help. 希望这会有所帮助。 BTW currently there is no 100% solution for this, we all suffer from this. 顺便说一句,目前还没有100%的解决方案,我们所有人都为此感到痛苦。

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

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