.NET WinForm Memory Consumption

前端 未结 3 1245
小蘑菇
小蘑菇 2020-12-21 15:36

I\'ve been profiling a WinForm\'s application using \".NET Memory Profiler\".

I can\'t quite seem to understand how my application is growing to 1GB, then 2GB, then

3条回答
  •  醉话见心
    2020-12-21 16:11

    I have found that under high CPU load that the garbage collection often gets a very low priority so the .NET libraries responsible for cleaning up unused memory will only fire off when they absolutely have to, in spite of the reference counts to a managed object going to zero. If it's possible try putting some intentional Thread.Sleep calls in your code or simply accept the fact that it's a memory hog and hope that the logic will allow your system to run and it will have "odd" memory usage as you never stated that anything breaks, it just has an unreal memory footprint.

提交回复
热议问题