473,811 Members | 2,597 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Memory leak

Hi,

I have an asp.net site that receives a medium amount of traffic (500-1k
users per day). I'm having massive trouble at the moment with a memory leak
that I just cannot isolate. The server is w2k, with 1GB ram, but the
asp.net process is recycling 2-3 times daily!

I've run perfmon over the last week to get a clear picture, and here's what
i see from it:

Looking at the 'private bytes' counter, it increases quite quickly from
around 1MB to 750MB in a matter of 6-12 hours (depending on load).

Gen 0 and Gen 1 are behaving as expected, never get very big, and are
relatively flat.
Large Object Heap, whilst bigger, is also flat, so not a contributor.
Gen 2 however is increasing at pretty much exactly the same rate as private
bytes, and never gets recycled except for when the asp.net process itself
recycles, or IIS gets reset.

I've read some good articles on msdn about this, but i'm afraid they weren't
too much help. I am hoping that someone has come across Gen 2 not recycling
before and has a few pointers as where to look next.

Cheers

Chris

Nov 18 '05 #1
4 1569
before you dive into mucking with generations etc, back up a bit and
re-examine your data structures and resource alloc/deallocation.

If you use datasets/datareaders, are you being carefull to null them out
when they are no longer in use. Are you closing your connections. Have you
guarded blocks of code with a finally construct or a catch handler to ensure
that resources are being cleanup up neatly. Have you considered replacing
string concatenations with stringbuilder for intense string manipulation.
Are you examining the number of exceptions and where they are coming from to
determine if they are causing memory leaks. Are you making use viewstate to
ease the load on the server. are you using caching effectively instead of
establishing new connections to grab repeat data requests?

The solution is probably in these unanswered questions. When you start
scaling a web application upward, these factors collectively make or break
an application.

--
Regards,
Alvin Bruney
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Ch***@yahoo.co m" <cemack2000 at yahoo dot com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Hi,

I have an asp.net site that receives a medium amount of traffic (500-1k
users per day). I'm having massive trouble at the moment with a memory leak that I just cannot isolate. The server is w2k, with 1GB ram, but the
asp.net process is recycling 2-3 times daily!

I've run perfmon over the last week to get a clear picture, and here's what i see from it:

Looking at the 'private bytes' counter, it increases quite quickly from
around 1MB to 750MB in a matter of 6-12 hours (depending on load).

Gen 0 and Gen 1 are behaving as expected, never get very big, and are
relatively flat.
Large Object Heap, whilst bigger, is also flat, so not a contributor.
Gen 2 however is increasing at pretty much exactly the same rate as private bytes, and never gets recycled except for when the asp.net process itself
recycles, or IIS gets reset.

I've read some good articles on msdn about this, but i'm afraid they weren't too much help. I am hoping that someone has come across Gen 2 not recycling before and has a few pointers as where to look next.

Cheers

Chris

Nov 18 '05 #2
Thanks for the post.

For the most part, yes I'm cleaning things up. I've had a couple of good
combs through the code, and yes, I found one or two places that I had to
tidy up, but for the most part everything that has a dispose method is being
called.

I don't explicitly set objects = null, as it's my understanding that you
don't need to do this anymore! Am I wrong? And if so, do I have to set
anything that's not a value data type = null when I'm done with it?

all connections are being closed, string manipulation is done with
stringbuilders, all resources are being cleaned up when using try/catch. I
do get on order of about 20-30 exceptions per day, however the majority of
those are time-outs on a page where the user can upload files. I've
experimented by disabling that functionality for a day, but there was no
impact on memory. I've gotten rid of viewstate as much as possible because
it only causes problems with some users. Some people just constantly get
viewstate corrupted messages.

There are a couple places where I could use caching more effectively,
they're on my to do list, *but* that's a performance issue, and shouldn't
be causing a memory leak.

I guess I don't understand what all this crap m$ are putting out about GC
and managed memory when it was just simpler when you had to clean up after
yourself.

Cheers

Chris



"Alvin Bruney" <vapor at steaming post office> wrote in message
news:OL******** ******@TK2MSFTN GP10.phx.gbl...
before you dive into mucking with generations etc, back up a bit and
re-examine your data structures and resource alloc/deallocation.

If you use datasets/datareaders, are you being carefull to null them out
when they are no longer in use. Are you closing your connections. Have you
guarded blocks of code with a finally construct or a catch handler to ensure that resources are being cleanup up neatly. Have you considered replacing
string concatenations with stringbuilder for intense string manipulation.
Are you examining the number of exceptions and where they are coming from to determine if they are causing memory leaks. Are you making use viewstate to ease the load on the server. are you using caching effectively instead of
establishing new connections to grab repeat data requests?

The solution is probably in these unanswered questions. When you start
scaling a web application upward, these factors collectively make or break
an application.

--
Regards,
Alvin Bruney
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Ch***@yahoo.co m" <cemack2000 at yahoo dot com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Hi,

I have an asp.net site that receives a medium amount of traffic (500-1k
users per day). I'm having massive trouble at the moment with a memory

leak
that I just cannot isolate. The server is w2k, with 1GB ram, but the
asp.net process is recycling 2-3 times daily!

I've run perfmon over the last week to get a clear picture, and here's

what
i see from it:

Looking at the 'private bytes' counter, it increases quite quickly from
around 1MB to 750MB in a matter of 6-12 hours (depending on load).

Gen 0 and Gen 1 are behaving as expected, never get very big, and are
relatively flat.
Large Object Heap, whilst bigger, is also flat, so not a contributor.
Gen 2 however is increasing at pretty much exactly the same rate as

private
bytes, and never gets recycled except for when the asp.net process itself recycles, or IIS gets reset.

I've read some good articles on msdn about this, but i'm afraid they

weren't
too much help. I am hoping that someone has come across Gen 2 not

recycling
before and has a few pointers as where to look next.

Cheers

Chris


Nov 18 '05 #3
Are you using any Interop in your application? Managed code cleans itself
up, but Interop doesn't necessarily. The most common cause of memory leaks
is unmanaged code.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Ch***@yahoo.co m" <cemack2000 at yahoo dot com> wrote in message
news:#B******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

I have an asp.net site that receives a medium amount of traffic (500-1k
users per day). I'm having massive trouble at the moment with a memory leak that I just cannot isolate. The server is w2k, with 1GB ram, but the
asp.net process is recycling 2-3 times daily!

I've run perfmon over the last week to get a clear picture, and here's what i see from it:

Looking at the 'private bytes' counter, it increases quite quickly from
around 1MB to 750MB in a matter of 6-12 hours (depending on load).

Gen 0 and Gen 1 are behaving as expected, never get very big, and are
relatively flat.
Large Object Heap, whilst bigger, is also flat, so not a contributor.
Gen 2 however is increasing at pretty much exactly the same rate as private bytes, and never gets recycled except for when the asp.net process itself
recycles, or IIS gets reset.

I've read some good articles on msdn about this, but i'm afraid they weren't too much help. I am hoping that someone has come across Gen 2 not recycling before and has a few pointers as where to look next.

Cheers

Chris

Nov 18 '05 #4
No, no interop.

I've even replaced the standard .net email code (which uses unmanaged code)
with a managed 3rd party component. (which didn't make any difference!).

Cheers

Chris
"Kevin Spencer" <ke***@takempis .com> wrote in message
news:Oc******** ******@TK2MSFTN GP11.phx.gbl...
Are you using any Interop in your application? Managed code cleans itself
up, but Interop doesn't necessarily. The most common cause of memory leaks
is unmanaged code.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Ch***@yahoo.co m" <cemack2000 at yahoo dot com> wrote in message
news:#B******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

I have an asp.net site that receives a medium amount of traffic (500-1k
users per day). I'm having massive trouble at the moment with a memory

leak
that I just cannot isolate. The server is w2k, with 1GB ram, but the
asp.net process is recycling 2-3 times daily!

I've run perfmon over the last week to get a clear picture, and here's

what
i see from it:

Looking at the 'private bytes' counter, it increases quite quickly from
around 1MB to 750MB in a matter of 6-12 hours (depending on load).

Gen 0 and Gen 1 are behaving as expected, never get very big, and are
relatively flat.
Large Object Heap, whilst bigger, is also flat, so not a contributor.
Gen 2 however is increasing at pretty much exactly the same rate as

private
bytes, and never gets recycled except for when the asp.net process itself recycles, or IIS gets reset.

I've read some good articles on msdn about this, but i'm afraid they

weren't
too much help. I am hoping that someone has come across Gen 2 not

recycling
before and has a few pointers as where to look next.

Cheers

Chris


Nov 18 '05 #5

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

Similar topics

8
3418
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
4821
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
6094
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
8122
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
4579
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
8559
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
6939
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
5332
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
15718
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
9370
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
9728
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10648
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10389
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...
0
6890
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5554
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
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4339
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
3867
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3018
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.