Solved

Trying to find memory leak in process

Posted on 2012-03-09
3
219 Views
Last Modified: 2012-03-13
I have a backend process that is called periodically by a service.  It checks a directory to see if there are any messages to handle.  QA tells me that if the service is running, even if it isn't processing any messages, it causes gradual memory usage increase.  An almost identical service (from which I copied my service) doesn't cause memory usage to increase.

I'm hoping to be able to see the memory usage increase when I run the service on my local machine, so I can comment out the various processes one at a time to figure out where the leakage is occurring, but I'm not sure how to do it.  There is a single entry method that the process uses, so I'm hoping if I take my snapshot and the beginning and end of the method, I should be able to tell if there was anything left open.

What could I use to gather this information in a way that would tell me if memory leakage was occuring inside a particular method?
0
Comment
Question by:FrancineTaylor
3 Comments
 
LVL 5

Accepted Solution

by:
sujithmd earned 500 total points
ID: 37704310
You can configure performance counters (please find the list below ) for some time and analyze the same with a utility called PAL which will tell a process is leaking memory or not.

technet.microsoft.com/en-us/library/cc768048.aspx

NB: ensure that your permanence log not too large else you won't be able to analyze anything.
0
 
LVL 13

Expert Comment

by:iHadi
ID: 37705182
The CLR components and garbage collection differs according to the hardware and system resources (optimization stuff), so emulating the exact memory behavior happening on a server on your PC is not a simple task.

I suggest you use a .NET CLR memory profiling software by installing it on the production system.

You can also submit the code of that 'particular' method here so the experts can help you more and point out any code that is causing the memory leaks.
0
 
LVL 3

Expert Comment

by:algorith
ID: 37705211
Is your service written in C#?  Microsoft states "Because of the garbage collection package that is implemented in the Microsoft .NET Framework, it is not possible to have a memory leak in managed code. "

(although it is possible in unmanaged code)

OTOH in C++ you can use the "debug heap" and the "Heap State Reporting Functions"
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question