473,471 Members | 1,728 Online
Bytes | Software Development & Data Engineering Community
Create 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 1298

"Sherif ElMetainy" <el*************@wayout.net.NOSPAM> wrote in message
news:OF**************@TK2MSFTNGP12.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.NOSPAM> wrote in message
news:OF**************@TK2MSFTNGP12.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.NOSPAM> wrote in message
news:ew**************@TK2MSFTNGP09.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
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....
2
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...
149
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? --...
2
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...
8
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...
6
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 =...
6
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...
35
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....
6
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...
3
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...
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...
0
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,...
0
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,...
1
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...
1
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
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.