Asp.Net Out of Memory Exceptions and <gcServer=false /> setting

Share on Facebook

This was such a life saver, I had to quickly document it here to save someone else the trouble. To begin with I am surprised, there are not that many hits on google about this particular setting in the aspnet.config file which can continously crash your server over and over.

This is the issue, I maintain an Asp.Net 2.0 web application which runs in its own application pool on a 64 bit multi-processor virtual server hosting space. The KEY here is the multi-processor bit. Apparently, the .Net Common Language Runtime (CLR) uses a server garbage collector in such environments which allocates a separate garbage collector instance for each processor's separate memory heap. This can very quickly result in excessive memory usage during garbage collection and eaily bring the server down and start displaying Server Unavailable messages to clients.

Well, that is the issue, what of the solution?. As it happens, there is a very simple solution. To workaround this behavior, configure the CLR to use the Workstation garbage collector:1. Open the Aspnet.config file in Notepad.exe. The file is located at %SystemRoot%\Microsoft.NET\Framework\v2.0.50727\Aspnet.config for .NET Framework 2.0 and at %SystemRoot%\Microsoft.NET\Framework\v1.1.4322\Aspnet.config for .NET Framework 1.1.2. In the section httpRuntime, add <<gcServer="false" />> (only one set of angle brackets!!) 3. Save the Aspnet.config file.

 

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkListkick it on DotNetKicks.comTwitThis

Comments

March 5. 2009 12:45 PM

chris

Nice one, Mike.
This fixed my ongoing asp.net application pool crashes.

You seem to be the only person on the internet who knows about this.

Ireland chris

March 9. 2009 03:34 AM

mike

Chris,

Happy to hear it helped you out. That was the compelling reason for sharing it, and thanks for the feedback!

United Kingdom mike

April 9. 2009 11:36 AM

UK Franchises

Hey, just checking out the blogengine.net platform...  Seems pretty nice.  What is the backend like?

Cheers

Matthew

United Kingdom UK Franchises

April 9. 2009 09:59 PM

miketeye

Very solid architecture. Supports both xml and sql server database as data store. very carefully thought out system all through. You will appreciate the design descisions if you dare to dive into the system. Works very well if all you want to do is blog. Very well supported extensions system with extensions to support all kinds of stuff from download counter to syntax highlighting.

hope this gives you an idea of the system in a nutshell.

United Kingdom miketeye

April 17. 2009 06:46 PM

Group Leadership

You did indeed save me the trouble! Thanks for documenting it!

United Kingdom Group Leadership

April 27. 2009 12:18 PM

Ferrari Electroplating

Well I had to leave a comment because I was really impressed with the quality of this post. You deserve to own a ferrari with writer skills like this. Unfortunately writers aren't appreciated online nearly close to what they should be, but anyway, heres my attempt to correct that situation. *Thumbs up.

United Kingdom Ferrari Electroplating

April 28. 2009 05:27 AM

miketeye

Oatis,

Thanks for the kind words. Glad it helped you out!

United Kingdom miketeye

June 22. 2009 07:52 PM

Tukang Nggame

nice article, thanks for taking the time to sharing this with us

United States Tukang Nggame

June 29. 2009 06:29 AM

Vivek

Hi,

We have issue of w3wp.exe using maximum memory usage on dedicated server. If we add gcServer="false" to app.config file will it help to reduce memory usage and clear all garbage memory.

We have other sites also on same server, will that reflect on all site on only one site.

Vivek Shrivastav

India Vivek

July 1. 2009 12:32 PM

miketeye

Vivek,

If the dedicated server is a multiprocessor machine, then using the gcServer=false setting as explained in the post should really reduce the memory usage. The gcServer=false setting is applied in the aspnet.config file, not the (app.config or web.config), so the setting applies to all sites running on the .Net framework on the server.

That is my understanding.

United Kingdom miketeye

July 20. 2009 03:29 PM

Charles Linden

Hello peeps, I have a short problem... I notice u are using blogengine from ms. I'm running a panic and anxiety disorder weblog on wordpress and i am willing to change. Does it only run on microsoft server?? Thanks, Debra Trotter

Netherlands Charles Linden

August 8. 2009 03:12 AM

San Diego Web Design

I just couldn't leave your website before saying that I really enjoyed the quality information you offer. Will be back often to check up on new stuff you post!

United States San Diego Web Design

August 8. 2009 03:12 AM

Learn German

I hadn�t thought of it before, but it�s definitely an interesting idea. Thanks for the insight.

United States Learn German

August 11. 2009 02:15 AM

seo

The ASP.NET login controls provide a robust login solution for ASP.NET Web applications without requiring programming. By default, login controls integrate with ASP.NET membership and forms authentication to help automate user authentication for a Web site.

United States seo

September 13. 2009 12:38 PM

payday online

Toto ozn�men� o stavu doru.en� je generov�no automaticky.

United States payday online

September 13. 2009 09:22 PM

payday loans

I leave a lot of comments on a lot of blogs each week - but there is one situation where I rarely leave a comment - even if the post deserves it.Good work

United States payday loans

October 5. 2009 03:05 AM

Social network marketing

Hi,
   Can anybody tell a tool which can be intgrated with website and will help me in internet marketing activities?

United States Social network marketing

November 1. 2009 12:24 AM

Website Design UK

I was searching for the same solution about memory exceptions to help your website and finally i found you through Google search Smile mind blowing!.

United Kingdom Website Design UK

November 1. 2009 03:32 AM

fast personal loans

Interesting ... as always - is your blog making any cash advance ? ;)

United States fast personal loans

November 20. 2009 01:23 PM

Depuz

It is tops how the old must rely on a complex point like memory. I'm feeling high spirited today. It hasn't been covered in the press yet. Do you want to avoid feeling despair? Let me share this with you. I need to investigate this situation further. I want to feel grateful. This is a good investment. ASP has had a long tradition. The procedure is pretty much the same. Immediately you question that statement. And yes, that translates into computing. This is where we'll have our last stand. Let's tap into the basics of software. Will the internet fall out of favor in the future.

United States Depuz

November 24. 2009 04:41 AM

Outsourcing

That's great, I never thought about Asp.Net Out of Memory Exceptions and <gcServer=false /> setting like that before.

United States Outsourcing

December 2. 2009 02:26 AM

Photo storage box

Thanks I have read this article and found some more valuable things

United States Photo storage box

December 6. 2009 11:22 AM

payday loans

Thank you for your help!

United States payday loans

December 9. 2009 05:39 AM

Agenzia Web Marketing

Good Post.It's really helpful and interesting

United States Agenzia Web Marketing

December 10. 2009 02:12 AM

ditte traslochi milano

Admiring the time and effort you put into your blog and detailed information you offer

United States ditte traslochi milano

December 11. 2009 07:34 AM

Yachtcharter Griechenland

That is really very good article. I am glad to know. Thanks!

United States Yachtcharter Griechenland

December 22. 2009 04:07 AM

instant cash advance

Just try to smile for about 2-3 mins then you can get back to work

United States instant cash advance

December 28. 2009 03:01 AM

payday loans

Just wanted to say thanks for this.

United States payday loans

January 4. 2010 04:00 AM

Premium Wordpress Themes

Wonderful writing skills you got mate.

United States Premium Wordpress Themes

January 10. 2010 01:27 PM

payday loans

try adding some spell check next time. ;) . bookmarked btw

United States payday loans

January 14. 2010 06:31 PM

fast payday loans

To win without risk is to triumph without glory.

United States fast payday loans

January 17. 2010 07:01 AM

instant advance

Snowflakes are one of nature's most fragile things, but just look what they can do when they stick together.

United States instant advance

January 22. 2010 12:25 PM

Michael Mesa Miami

hey mate great post, love the technique

United States Michael Mesa Miami

January 25. 2010 11:36 AM

payday advance

i totally disagree .. now I'm just curious if this one will get posted

United States payday advance

Add comment


(Will show your Gravatar icon)

  Country flag

Click to change captcha
biuquote
  • Comment
  • Preview
Loading



About Me

When not scratching my head for solutions to software challenges, I spend my time playing with my little boy - Michael Jnr.

Quotations

"Anger is never without Reason, but seldom with a good One."
Benjamin Franklin

Donate with PayPal - it

Calendar

<<  March 2010  >>
MoTuWeThFrSaSu
22232425262728
1234567
891011121314
15161718192021
22232425262728
2930311234

View posts in large calendar

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2005 - 2010

Search