性能分析一:查看程序占用系统的内存 .

服务器端内存增长的很快,不好跟踪调试。

于是写了一个winform小程序,查看程序占用系统多少内存,然后调用一下服务器端的接口,加载后然后再看一下现在内存是多少。

是个笨办法,但快速定位了让iis内存飞速增长的代码段。

using System.Diagnostics;



 // 获得为该进程(程序)分配的内存. 做一个计时器,就可以时时查看程序占用系统资源

 public double GetProcessUsedMemory()

    {

        double usedMemory = 0;

        usedMemory = Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0;

        return usedMemory;

    }

  

原文地址:https://www.cnblogs.com/liyongjian/p/3056344.html