473,804 Members | 3,113 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GC doesn't work in my ASP.NET application

Hello

I have an ASP.NET application that just keeps leaking memory. The memory
used by the application just keeps growing until the ASP.NET worker process
is recycled when the memory limit is reached. I looked at the performance
data and here is what I found:

ASP.NET Requests Total : 28462 (Keeps increasing)
ASP.NET Requests/Sec: 2 (5 in peak hours)
Gen 0 Collections : 157 (This is really bizzare that after more that 28K
requests)
Gen 1 Collections: 76
Gen 2 Collections: 10
Induced GC: 3 (My code doesn't have a call to GC.Collect anywhere, and I am
not using 3rd party components that may do that)
#Bytes in all heaps: 237MB (Keeps increasing)
Gen 0 Heap Size: 98MB (keeps increasing)
Gen 1 Heap Size: 7MB
Gen 2 HeapSize: 130 MB
Large object Heap Size: 1MB
% of time in GC: 0.032

My question is why do I have so few garbage collections? Why is Gen 0 so
big? I read that it is typically the size of the processor's cache, but
98MB? Why aren't they promoted to gen 1 or gen 2?

My application is running with the following configuration:

Compaq ProLiant ML370 G3
Quad Intel Xeon 2.8GHz Processors
Windows 2000 Server (Service Pack 4)
2GB RAM
Microsoft .NET Framework 1.1 (Without Service Pack 1. Is this the reason?)

Best regards,
Sherif
Nov 19 '05 #1
3 1311

"Sherif ElMetainy" <el************ *@wayout.net.NO SPAM> wrote in message
news:OF******** ******@TK2MSFTN GP12.phx.gbl...
Hello All

Thanks to everyone who replied. I found a bug in my code that caused some
allocated objects to be referenced by static variables. Fixing it solved
the
problem. But I still wander why were these leaked objects not promoted to
Gen 1 or Gen 2? Why did Gen 0 remain big?
Why did I have only 157 Gen 0 Collections after more than 28000 request?


I think because the GC's weren't freeing much memory, the GC heruistics
concluded that your app needed more and more memory and so it kept
increasing its memory targets and thus running GC less and less frequently.

If you look at those 157 Gen 0 GC's I imagine you would see something like

Gen 0 GC Gen 0 Size Before(MB) Gen 0 Size After(MB)
----------------------------------------------------------------------
1 .1 .1
1 .1 .1
1 .1 .1
1 .1 .1
1 .1 .1
1 .1 .1
Nov 19 '05 #2

"Sherif ElMetainy" <el************ *@wayout.net.NO SPAM> wrote in message
news:OF******** ******@TK2MSFTN GP12.phx.gbl...
Hello All

Thanks to everyone who replied. I found a bug in my code that caused some
allocated objects to be referenced by static variables. Fixing it solved
the
problem. But I still wander why were these leaked objects not promoted to
Gen 1 or Gen 2? Why did Gen 0 remain big?
Why did I have only 157 Gen 0 Collections after more than 28000 request?


oops
I think because the GC's weren't freeing much memory, the GC heruistics
concluded that your app needed more and more memory and so it kept
increasing its memory targets and thus running GC less and less frequently.

If you look at those 157 Gen 0 GC's I imagine you would see something like

Gen 0 GC Gen 0 Size Before(MB) Bytes Promoted to Gen 1
----------------------------------------------------------------
1 .1 .1
2 .2 .2
3 .4 .3
4 1.0 .9
5 2.0 1.7
6 4.0 3.9
7 8.0 6.9
8 16.0 14.9
....

Each GC was so unsucessful and resulted in so much promoted memory that the
targets for the next GC kept going up, and with a constant rate of object
allocation the frequence of GC went down.
David
Nov 19 '05 #3

"Sherif ElMetainy" <el************ *@wayout.net.NO SPAM> wrote in message
news:ew******** ******@TK2MSFTN GP09.phx.gbl...
Hello

I already did that. This was the first thing that came to my mine.
GC.Collect() call in the EndRequest method. The result was that Gen 0 Heap
size was down to 1MB but the time spent in GC was 99.5% and CPU
consumption
went up, and my application was slow. I would rather have 2-3 process
recycles all day than having such a bad performance


Of course you would never really run your application with a forced GC after
every page render, but it can help diagnose the problem. But you can only
"see" a memory leak after removing the garbage.

Forcing GC will always clear out Gen 0, promoting reachable objects to Gen
1. What you want to see is whether the total amount of managed memory goes
down.

For an ASP.NET web app with a single user, the app should basically return
to its inital state after each Page is rendered. If memory continues to
climb, then you have a memory leak.

David
Nov 19 '05 #4

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

Similar topics

11
2203
by: Julian | last post by:
Hi I have code in my login.asp which sets the online field in user database to true or 1. I am trying to use the same code in global.asa to change back the online field to 0 but it doesn't work. The code is very simple and it should work, any idea why it doesn't? Sub Session_OnEnd If Session("User_ID")<>" " Then ' check if user has logged in before.
2
2390
by: jerry | last post by:
I'm trying to run an application under another user within a winform app writen in C#. I have tried a number of different things, but it seems that the CreateProcessWithLogonW function should work to do what I need to do. This appears to work just fine in Windows 2000 and XP with service pack 1, but it doesn't work with XP service pack 2 installed. I'm sure it's one of the "Enhanced security features" of service pack 2, but I can't...
149
25223
by: Christopher Benson-Manica | last post by:
(Followups set to comp.std.c. Apologies if the crosspost is unwelcome.) strchr() is to strrchr() as strstr() is to strrstr(), but strrstr() isn't part of the standard. Why not? -- Christopher Benson-Manica | I *should* know what I'm talking about - if I ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
2
2786
by: Mike Belshe | last post by:
I've got an outlook add-in. I'm running Outlook XP, .NET 1.1. My Add-In is written in C#. I'm trying to trap either the Application.ItemSend or the MailItem.ItemSend event to put up a dialog and possibly let the user cancel the send. I can get the events to fire, but setting the Cancel flag doesn't work. I set Cancel to true, and the message is sent anyway. Here is the simple code. Again, my event handler does get called- I can
8
2046
by: Luminal | last post by:
Greetings Recently I've developed a C# application using an Access database. For this I use the Data.OleDb namespace. Now I have customer telling me that he can't use the application. The application does not work because it has no database. In theory, if the database does not exists, my application tries to create it, but it seems that the application can not create the database... and my client does not have MS Access installed on...
6
13305
by: A.M-SG | last post by:
Hi, I have an aspx page at the web server that provides PDF documents for smart client applications. Here is the code in aspx page that defines content type: Response.ContentType = "application/octet-stream"; Response.AppendHeader("Content-Disposition", "attachment;filename=" + fileID.ToString() + ".pdf");
6
12852
by: Ole | last post by:
Hi, I'm running a command line process from my C# application trying to catch the output messages from the process into a textbox in my windows form. But the text doesn't update (the ReadLine doesn't return) until the process exits??? Any help is highly appreciated! The code is like this: Process myProcess = new Process(); myProcess.StartInfo.FileName = Application.StartupPath + "\\myCmdLine.exe";
35
3061
by: mwelsh1118 | last post by:
Why doesn't C# allow incremental compilation like Java? Specifically, in Java I can compile single .java files in isolation. The resulting individual .class files can be grouped into .jar files. In C#, there appears to be no analog. I have to compile all my .cs files into a single .dll. This has serious drawbacks in terms of compilation. With Eclipse, I change a file and only that file is re-compiled. With Visual Studio, I
6
1945
by: Johnny Jörgensen | last post by:
I've got a usercontrol derived from a normal ComboBox that contains some special formatting code. On my main form I've got a lot of my custom comboboxes. I discovered a bug in the derived control and fixed it. But it still doesn't work for the controls already added to the form. It works fine for new instances of the control dragged from the toolbox to the form. I don't want to have to drag and drop new controls to exchange all my old...
3
689
by: =?Utf-8?B?Um9nZXIgTWFydGlu?= | last post by:
Note: My apologies for repeating this post from last week, but my nospam alias and profile account were incorrect. I think I have fixed this, so hopefully this post will trigger MS into a response per their MSDN policy. -------------------- I have a web site under .NET 2.0 that renders videos using the Silverlight media player. The web page looks like this: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="video2.aspx.cs"
0
9706
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
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10578
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
10332
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
10077
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
9152
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
7620
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
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4300
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

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.