469,645 Members | 1,634 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,645 developers. It's quick & easy.

Memory Leaks in C#

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
Nov 15 '05 #1
5 1588
Try a profiler,
here is one you can start with
http://www.gotdotnet.com/Community/U...d-bfd7cb3154ac
-Dino

"Valerie Hough" <su*****@hcs-usa.com> wrote in message
news:uc**************@TK2MSFTNGP11.phx.gbl...
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

Nov 15 '05 #2
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ť

"Dino Chiesa [Microsoft]" <di****@online.microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Try a profiler,
here is one you can start with
http://www.gotdotnet.com/Community/U...d-bfd7cb3154ac -Dino

"Valerie Hough" <su*****@hcs-usa.com> wrote in message
news:uc**************@TK2MSFTNGP11.phx.gbl...
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


Nov 15 '05 #3

"Josť Joye" <jo*******@KILLTHESPAMSbluewin.ch> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
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> ?
Nov 15 '05 #4
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/de...evPartner&sf=1
"Valerie Hough" <su*****@hcs-usa.com> wrote in message
news:uc**************@TK2MSFTNGP11.phx.gbl...
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

Nov 15 '05 #5
You are more than right. Simply typing the name of the service in the
related box fill up automatically the net start command...
Josť

"Stu Banter" <x2**************@westerterp.com> wrote in message
news:3f***********************@dreader9.news.xs4al l.nl...

"Josť Joye" <jo*******@KILLTHESPAMSbluewin.ch> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
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> ?

Nov 15 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Maurice | last post: by
reply views Thread by Steve Binney | last post: by
4 posts views Thread by Morten Aune Lyrstad | last post: by
2 posts views Thread by Generic Usenet Account | last post: by
8 posts views Thread by ranjeet.gupta | last post: by
4 posts views Thread by ali.jan | last post: by
23 posts views Thread by James | last post: by
3 posts views Thread by Jim Land | last post: by
16 posts views Thread by graham.keellings | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.