0

I've been reading about Memory Leaks these past few days and I'm affraid that this might be a problem that is currently affecting my application written in C#. It should consume around 250 MBs of my total memory (that's what it consumes around the first few hours) however, I've noticed that in average this value doubles everyday. For example, this is the 5th day that it have been running and right now it's consuming around 1.2 GB of memory.

So, I've downloaded In-depth .NET Memory Profiling from SciTech Software since I noticed this is actually a reccomended software around here and took 3 snapshots in different periods. However, after spending a considerable amount of time trying to understand them or even link them to my code it seems I have failed so far.

Therefore, I would like to know firstly if the memory profiler I'm using is actually a good one and then if any of you knows any guide or walkthrough on how to understand and reach conclusions with this or any other memory profiler as well as obviously how can I find solutions to my memory leaks with it.

Thanks in advance for the support.

NyoPHP
  • 39
  • 1
  • 6
  • Can you run your software in the Visual Studio debugger? There's a built-in profiler there that can tell you what objects are causing problems. – Grace Jun 13 '16 at 21:15
  • the best thing to do besides using the `Debugger` would be to do a global search where you are using the key word `new` make sure that you are disposing of the objects manually or try wrapping the objects around a `using(){}` clause. 2nd I would check to see if you are declaring any objects like this for instance `Object objVariable;` or if you have `Object objVariable = null;` in the Method and or at that class level. perhaps you could install `Resharper` it will give tons of hints and clues as well .. hard to determine exactly without seeing some code – MethodMan Jun 13 '16 at 21:19
  • Also look for event handlers that aren't being unsubscribed. ["Until you unsubscribe from an event, the multicast delegate that underlies the event in the publishing object has a reference to the delegate that encapsulates the subscriber's event handler. As long as the publishing object holds that reference, garbage collection will not delete your subscriber object."](https://msdn.microsoft.com/en-us/library/ms366768.aspx). – Quantic Jun 13 '16 at 21:39
  • Something is likely ending up on the Large Object Heap. .Net sometimes just isn't very good for long-running processes. – Joel Coehoorn Jun 13 '16 at 21:58
  • This is not a place to ask for product support. Besides, such troubleshooting is expensive itself. Talk to the presale of this product to see if they can offer your assistance. – Lex Li Jun 14 '16 at 01:12

1 Answers1

0

Check this post: What Are Some Good .NET Profilers? I have had some good experiences with the products mentioned in the top post. It would be a great help for you to install a standalone test system with an automated test that simulates usage. This would allow you to speed up stuff and not need to wait for days to see changes. Assuming you are using VS2015, you could use the Diagnostic Tools Window: https://blogs.msdn.microsoft.com/visualstudioalm/2015/01/16/diagnostic-tools-debugger-window-in-visual-studio-2015/ https://blogs.msdn.microsoft.com/visualstudioalm/2015/04/29/diagnosing-event-handler-leaks-with-the-memory-usage-tool-in-visual-studio-2015/

Community
  • 1
  • 1
Manu Meyer
  • 191
  • 6