OutOfMemoryException异常 - 出出主意主意、异常、OutOfMemoryException

2023-09-03 15:13:40 作者:一杯浊酒笑风尘

我知道有没有简单的回答我的问题,但我会AP preciate思想,指导或 某种东西到查找在列表

I know there is no simple answer to my question but I would appreciate ideas, guides or some sort of things-to-look-at list

我有一个网络的Windows服务,不断抛出OutOfMemoryException异常。 该服务有两个版本的x86和x64的Windows。然而在x64它消耗了很多 记忆。我曾尝试与不同的内存分析器分析它。但我不能得到一个线索是什么问题。诊断 - 服务消费VMSize的很多,崩溃后3〜12小时的应用程序。该behaviuor是相当随机的 - 没有任何可观察到的图案碰撞场景

I have a net Windows service that is constantly throwing OutOfMemoryException. The service has two builds for x86 and x64 Windows. However on x64 it consumes a lot more memory. I have tried profiling it with various memory profilers. But I cannot get a clue what the problem is. The diagnosis - service consumes lot of VMSize and crashes app after 3 to 12 hours. The behaviuor is rather stochastic - there is no observable pattern for crash scenario.

我也想看看性能计数器(PERFMON.EXE)。我可以看到的是, 堆大小的增长和GC%的时间平均为19%。加上内存分配与相关%的CPU时间。

Also I tried to look at performance counters (perfmon.exe). What I can see is that heap size is growing and %GC time is on average 19%. Plus memory allocation is correlated with %CPU time.

我的应用程序的线程和锁定的对象,数据库连接和WCF接口。 我试图解决一般问题:

My application has threads and locking objects, DB connections and WCF interface. The general question that I am trying to solve:

这纯粹是没有GC速度不够快   对GC的物体或一些非管理   (视窗)对象被消耗   内存?

Is it simply GC not been fast enough to GC objects or some non-managed (windows) objects are consuming memory?

请参阅列表中的第一个应用程序

See first app in list

链接到图片与性能计数器查看 https://m.xsw88.com/allimgs/daicuo/20230903/5090.png.jpg

The link to picture with performance counters view https://m.xsw88.com/allimgs/daicuo/20230903/5090.png.jpg

推荐答案

是你的问题,你不知道什么是占用了大量的内存?您可以打开,当进程正在使用大量内存的任务管理器,右击你的过程,并创建可在WinDbg中检查找出到底什么是分配内存转储文件。

Is your issue that you don't know what is consuming a lot of memory? You can open up task manager when the process is using a lot of memory, right click your process and create a dump file which you can examine in windbg to find out exactly what's allocating memory.

苔丝Ferrandez有很多出色的演示。 她经历的最有用的东西在这里...

Tess Ferrandez has a lot of excellent demos. She goes through the most useful stuff here...