Poll C# app's memory usage at runtime?

后端 未结 5 1100
傲寒
傲寒 2020-12-14 02:42

I have an app that, while running, needs to poll its own memory usage. It would be ideal if it could list out the memory usage for each object instantiated. I know this ca

5条回答
  •  爱一瞬间的悲伤
    2020-12-14 03:12

    You could listen on perfmon counters, which will give you plenty of data (GC activity / physical memory usage / managed heap etc..)

    If you need to go deeper you will probably have to attach a debugger to yourself, which is really super tricky cause you will have to spawn a new process and communicate with it, and walk through your memory.

提交回复
热议问题