473,382 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

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 1693
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Maurice | last post by:
Hi there, I'm experiencing big memory problems on my webserver. First on an old RedHat 7.2 system, now on an other fresh installed Suse 8.2 system: Linux version 2.4.20-4GB...
0
by: Steve Binney | last post by:
My code makes synchronous HttpWebRequest and HttpRebResponse calls. In VS 2003, I am getting memory leaks and event handle leaks. I am closing all streams and using "using"statements. I have...
4
by: Morten Aune Lyrstad | last post by:
Ok, now I'm officially confused. I have a large project going, which uses a win32 ui library I am developing myself. And I'm getting weird memory leaks. I don't know if I can explain what is going...
2
by: Generic Usenet Account | last post by:
I have been using STL for a long time now, without any problems. Recently we generated a purification report on our software using Rational Purify, and we found some memory leaks. My colleague...
8
by: ranjeet.gupta | last post by:
Dear All Is the Root Cause of the Memory corruption is the Memory leak, ?? suppose If in the code there is Memory leak, Do this may lead to the Memory Corruption while executing the program ? ...
0
by: Frank Lopez | last post by:
Does anyone know if Microsoft generated a whitepaper on this topic? Does anyone know what the solution is? (meaning, eliminate the leak problem -- I am seeing three memory leaks from...
4
by: ali.jan | last post by:
Hi, It is trivial to load an assembly in a new Application Domain. Is there any way of loading an assembly in a new process? I tried using the Process class like this: Process p = new...
23
by: James | last post by:
The following code will create memory leaks!!! using System; using System.Diagnostics; using System.Data; using System.Data.SqlClient; namespace MemoryLeak
3
by: Jim Land | last post by:
Jack Slocum claims here http://www.jackslocum.com/yui/2006/10/02/3-easy-steps-to-avoid-javascript- memory-leaks/ that "almost every site you visit that uses JavaScript is leaking memory". ...
16
by: graham.keellings | last post by:
hi, I'm looking for an open source memory pool. It's for use on an embedded system, if that makes any difference. Something with garbage collection/defragmentation would be nice. It should have...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.