473,883 Members | 1,772 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Memory leak in C#

Hi All,

I have developed a server application in C#. While running this
application, it is not running more than 30 minutes due to memory leak.
Could you tell me what will be the problem?

Thanks & Regards,

Raja.GS
Apr 28 '06 #1
8 2826
Raja Gregory wrote:
I have developed a server application in C#. While running this
application, it is not running more than 30 minutes due to memory leak.
Could you tell me what will be the problem?


Chances are you're holding on to a reference somewhere that you
shouldn't be. Without seeing any code or having any other information,
it's impossible to say more than that, really.

Jon

Apr 28 '06 #2
Thanks for the immediate reply. This is a big telecom application. I am
using lot of Hashtables and ArrayList in this project. How can I figure out
which is causing this problem? Is it any tool is there?

Thanks,
Raja.GS

"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:11******** **************@ y43g2000cwc.goo glegroups.com.. .
Raja Gregory wrote:
I have developed a server application in C#. While running this
application, it is not running more than 30 minutes due to memory leak.
Could you tell me what will be the problem?


Chances are you're holding on to a reference somewhere that you
shouldn't be. Without seeing any code or having any other information,
it's impossible to say more than that, really.

Jon

Apr 28 '06 #3
Likely to be when calling unmanged code, but diff to say without seeing some
code.

"Raja Gregory" <Ra**********@a spect.com> wrote in message
news:O%******** ********@TK2MSF TNGP05.phx.gbl. ..
Hi All,

I have developed a server application in C#. While running this
application, it is not running more than 30 minutes due to memory leak.
Could you tell me what will be the problem?

Thanks & Regards,

Raja.GS

Apr 28 '06 #4
> Chances are you're holding on to a reference somewhere that you
shouldn't be. Without seeing any code or having any other information,
it's impossible to say more than that, really.

Jon


Jon - while developing several big applications (managed-code only!) I have
seen very rare and nondeterministi c [Out of memory] exceptions. I belive
then that the garbage collector could somehow be mistaken in those few
situations (does anyone have a formal proof of gc correctness? I do not
think so and even if the proof exists it only proves that the algorithm is
correct and not the actual implementation) . However, since I've never been
able to reproduce these problems, I've never paid much attention to them.

Raja - do you monitor the memory consumption of your application? Does the
memory consumption increases constantly by small fractions and then the
crash happens? Or maybe the memory stays at some fixed rate but then there
is a sudden allocation of big block of memory that causes the crash? Also,
as Simon suggested, are you using unmanaged resources?

Wiktor Zychla

Apr 28 '06 #5
Wiktor:

Yes the memory consumption increases constantly by small fractions and then
the
crash is happening. Basically my module is processing lot of events. Crash
is depending on no of events it is processing. Those events are trigged by
external another managed code module.

For example:- Agent Signed In event.

If no. of agents signed in is high, it will crash immediately.

Thanks,

Raja.GS

"Wiktor Zychla [C# MVP]" <wz*****@nospm. ii.uni.wroc.pl. nospm> wrote in
message news:ub******** ******@TK2MSFTN GP03.phx.gbl...
Chances are you're holding on to a reference somewhere that you
shouldn't be. Without seeing any code or having any other information,
it's impossible to say more than that, really.

Jon

Jon - while developing several big applications (managed-code only!) I

have seen very rare and nondeterministi c [Out of memory] exceptions. I belive
then that the garbage collector could somehow be mistaken in those few
situations (does anyone have a formal proof of gc correctness? I do not
think so and even if the proof exists it only proves that the algorithm is
correct and not the actual implementation) . However, since I've never been
able to reproduce these problems, I've never paid much attention to them.

Raja - do you monitor the memory consumption of your application? Does the
memory consumption increases constantly by small fractions and then the
crash happens? Or maybe the memory stays at some fixed rate but then there
is a sudden allocation of big block of memory that causes the crash? Also,
as Simon suggested, are you using unmanaged resources?

Wiktor Zychla

Apr 28 '06 #6
Raja,

Even if you're not doing any com interop, some classes in the framework
do. Check all classes which you use, and see if the class implements a
Dispose method. If it does you'll need to call Dispose before you
release the reference to that object.

Apr 28 '06 #7
Please stop guessing, start measuring. There are a number of good memory
profilers around for .NET.
First there is the 'ClrProfiler' freely downloadable from
http://www.microsoft.com/downloads/d...displaylang=en
another decent one is the scitech profiler, a preview is available from
http://www.scitech.se/.

Willy.
"Raja Gregory" <Ra**********@a spect.com> wrote in message
news:ec******** ******@TK2MSFTN GP03.phx.gbl...
| Wiktor:
|
|
|
| Yes the memory consumption increases constantly by small fractions and
then
| the
| crash is happening. Basically my module is processing lot of events. Crash
| is depending on no of events it is processing. Those events are trigged by
| external another managed code module.
|
|
|
| For example:- Agent Signed In event.
|
| If no. of agents signed in is high, it will crash immediately.
|
|
|
| Thanks,
|
| Raja.GS
|
|
|
| "Wiktor Zychla [C# MVP]" <wz*****@nospm. ii.uni.wroc.pl. nospm> wrote in
| message news:ub******** ******@TK2MSFTN GP03.phx.gbl...
| > > Chances are you're holding on to a reference somewhere that you
| > > shouldn't be. Without seeing any code or having any other information,
| > > it's impossible to say more than that, really.
| > >
| > > Jon
| > >
| >
| > Jon - while developing several big applications (managed-code only!) I
| have
| > seen very rare and nondeterministi c [Out of memory] exceptions. I belive
| > then that the garbage collector could somehow be mistaken in those few
| > situations (does anyone have a formal proof of gc correctness? I do not
| > think so and even if the proof exists it only proves that the algorithm
is
| > correct and not the actual implementation) . However, since I've never
been
| > able to reproduce these problems, I've never paid much attention to
them.
| >
| > Raja - do you monitor the memory consumption of your application? Does
the
| > memory consumption increases constantly by small fractions and then the
| > crash happens? Or maybe the memory stays at some fixed rate but then
there
| > is a sudden allocation of big block of memory that causes the crash?
Also,
| > as Simon suggested, are you using unmanaged resources?
| >
| > Wiktor Zychla
| >
|
|
Apr 28 '06 #8
Thanks Willy !,
I will run with the tools

"Willy Denoyette [MVP]" <wi************ *@telenet.be> wrote in message
news:uT******** ******@TK2MSFTN GP03.phx.gbl...
Please stop guessing, start measuring. There are a number of good memory
profilers around for .NET.
First there is the 'ClrProfiler' freely downloadable from
http://www.microsoft.com/downloads/d...displaylang=en another decent one is the scitech profiler, a preview is available from
http://www.scitech.se/.

Willy.
"Raja Gregory" <Ra**********@a spect.com> wrote in message
news:ec******** ******@TK2MSFTN GP03.phx.gbl...
| Wiktor:
|
|
|
| Yes the memory consumption increases constantly by small fractions and
then
| the
| crash is happening. Basically my module is processing lot of events. Crash | is depending on no of events it is processing. Those events are trigged by | external another managed code module.
|
|
|
| For example:- Agent Signed In event.
|
| If no. of agents signed in is high, it will crash immediately.
|
|
|
| Thanks,
|
| Raja.GS
|
|
|
| "Wiktor Zychla [C# MVP]" <wz*****@nospm. ii.uni.wroc.pl. nospm> wrote in
| message news:ub******** ******@TK2MSFTN GP03.phx.gbl...
| > > Chances are you're holding on to a reference somewhere that you
| > > shouldn't be. Without seeing any code or having any other information, | > > it's impossible to say more than that, really.
| > >
| > > Jon
| > >
| >
| > Jon - while developing several big applications (managed-code only!) I
| have
| > seen very rare and nondeterministi c [Out of memory] exceptions. I belive | > then that the garbage collector could somehow be mistaken in those few
| > situations (does anyone have a formal proof of gc correctness? I do not | > think so and even if the proof exists it only proves that the algorithm is
| > correct and not the actual implementation) . However, since I've never
been
| > able to reproduce these problems, I've never paid much attention to
them.
| >
| > Raja - do you monitor the memory consumption of your application? Does
the
| > memory consumption increases constantly by small fractions and then the | > crash happens? Or maybe the memory stays at some fixed rate but then
there
| > is a sudden allocation of big block of memory that causes the crash?
Also,
| > as Simon suggested, are you using unmanaged resources?
| >
| > Wiktor Zychla
| >
|
|

Apr 28 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
3425
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 ? In nut shell, what is/are the realtion/s between the Memory Leak and Memory Corruption. Juts Theoritical Assumtion below:
17
4830
by: José Joye | last post by:
Hi, I have implemented a Service that is responsible for getting messages from a MS MQ located on a remote machine. I'm getting memory leak from time to time (???). In some situation, it is easier to reproduce (e.g.: remote machine not available). After about 1 day, I get a usage of 300MB of memory. I have used .NET Memory Profiler tool to try to see where the leak is located. For all the leaky instances, I can see the following (I...
4
6100
by: Don Nell | last post by:
Hello Why is there a memory leak when this code is executed. for(;;) { ManagementScope scope = new ManagementScope(); scope.Options.Username="username"; scope.Options.Password="password"; scope.Path.Path=@"\\pc\root\cimv2";
20
8131
by: jeevankodali | last post by:
Hi I have an .Net application which processes thousands of Xml nodes each day and for each node I am using around 30-40 Regex matches to see if they satisfy some conditions are not. These Regex matches are called within a loop (like if or for). E.g. for(int i = 0; i < 10; i++) { Regex r = new Regex();
23
4584
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
8
8565
by: Adrian | last post by:
Hi I have a JS program that runs localy (under IE6 only) on a PC but it has a memory leak (probably the known MS one!) What applications are there that I could use to look at the memory usage of each object within my JS app to help locate my problem? Thanks
7
6943
by: Salvador | last post by:
Hi, I am using WMI to gather information about different computers (using win2K and win 2K3), checking common classes and also WMI load balance. My application runs every 1 minute and reports the status of the machines. Upon we follow the .NET object lifetime recommendations the application is constantly consuming more memory! The problem is on the ManagementObjectSearch, upon we Dispose the object it seems that is not releasing the...
3
5334
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". Anybody know anything about this? Does *Javascript* leak memeory, or does the *browser* leak memory?
7
15725
by: Ragnar Agustsson | last post by:
Hi all I have been wandering about the best way to sandbox memory leaks in 3rd party libraries when using them from the .Net framework. I have a 3rd party library, written in C++, that leaks a lot of memory but I still had to use it. 1. After using DLLImport and seeing the memory leak I tried to load and
22
9378
by: Peter | last post by:
I am using VS2008. I have a Windows Service application which creates Crystal Reports. This is a multi theaded application which can run several reports at one time. My problem - there is a memory leak someplace. I can not detect the memory leak by running several reports by hand, but when I run tha app as a servrice and process few hundred reports there is significant memory leak. The application can consume over 1GB of memory where it...
0
10757
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10860
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10420
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9583
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7975
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5804
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6002
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4620
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4225
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.