Solved

Trying to find memory leak in process

Posted on 2012-03-09
3
216 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now