How do I profile memory usage in my project

后端 未结 3 2059
刺人心
刺人心 2020-12-11 16:58

Are there any good, free tools to profile memory usage in C# ?

Details:
I have a visualization project that uses quite large collections. I wou

相关标签:
3条回答
  • 2020-12-11 17:15

    JetBrains DotTrace is also good. I have used both the RedGate and JetBrains products and they both do a very good job of identifying the bottlenecks and leaks.

    0 讨论(0)
  • 2020-12-11 17:21

    I've had success using RedGate's ANTS profiler. It is also worth reading Brad Abrams blog where he has talked about profiling memory

    0 讨论(0)
  • I'm amazed noone has mentioned the free CLR Profiler from Microsoft!

    I didn't know of this tool until recently. I had a bug that made my program keep allocating more and more memory. The CLR Profiler can pinpoint memory-allocating "hot spots" in your program.

    I identified the line of code responsible for the leak, within 15-20 minutes of installing the profiler.

    Basically, it instruments your code and runs it with some profiling (which slows down your code considerably, 10x-100x are the official figures I think).

    You run a certain workload for a certain amount of time, and you can then see which places in your code that allocated how much memory (and how much was freed versus how much was retained etc.).

    Check it out at: https://clrprofiler.codeplex.com/

    Also, here is a tutorial on how to use the tool: http://geekswithblogs.net/robp/archive/2009/03/13/speedy-c-part-4-using---and-understanding---clr.aspx

    0 讨论(0)
提交回复
热议问题