Memory Leaks in C#

V

Valerie Hough

Currently our client runs one particular C# .NET executable, and after a few
hours performance slows to a crawl. It would be very useful for me to be
able to rule in (or out) the possibility that it is a result of memory
leakage.

Can someone point me to an article that discusses how bad programming may
produce memory leaks? The application is particularly list box intensive
(owner drawn, so pens, fonts, and brushes abound - all those things I would
religiously destroy immediately after use in my C++ apps). I never see any
messages in the debugger (a la C++) when the application terminates that
report leaks.

The application also does alot of SQL Server querying - are there disposal
issues there?

I would be particularly interested in any objects that should be disposed of
right after they are used (pens, fonts, arrays, brushes, etc)

I would also be very interested in any tools that will allow me to verify
that a particular .exe (or the DLLs it uses)is/are leaking.

Thank you in advance.
Chris Hough
 
J

José Joye

I need to profile a NT Service.
In the app menu there is a line wich says:
Command to Start the Service: .....

What are we supposed to put in?

José
 
S

Stu Banter

José Joye said:
I need to profile a NT Service.
In the app menu there is a line wich says:
Command to Start the Service: .....

What are we supposed to put in?

José

I may have misinterpreted this, but do you need this: net start
<servicename> ?
 
F

Fred Mellender

It is easy to determine if the CLR has a leak (but not where it is in your
code) by using the provided performance counters:
1. Control Panel/Administrative Tools/Performance
2. Right click in the display window to get menu.
3. Select Add Counters
4. On the pull-down menu, select .NET CLR Memory
5. Add the counter "#bytes in all heaps"

If this steadily increases you are continuing to allocate memory. It might
be a leak, or just an application loop that adds memory and keeps a
reference to it indefinitely.

For a statement level profiler, you can use the free profiler at
http://www.compuware.com/products/d...r+Community+Edition'&offering=DevPartner&sf=1
 
J

José Joye

You are more than right. Simply typing the name of the service in the
related box fill up automatically the net start command...


José
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top