Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Performance / December 2005

Tip: Looking for answers? Try searching our database.

ASP.NET OutOfMemoryException

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kevin.kenny@zygonia.net - 09 Dec 2005 15:14 GMT
Hi All,

We are having problems with OutOfMemoryExceptions in our hosting
environment.

The web servers are running Windows 2003 web edition with 2GB of
physical RAM and the page file size set to 3.5GB.

The ASP.NET worker process memory usage reaches roughly 800MB and then
we start to get out of memory exceptions.

Task manager shows ~650MB of physical memory free so why is ASP.NET not
able to allocate any more memory?

Thanks
Kevin
Alvin Bruney - ASP.NET MVP - 09 Dec 2005 17:08 GMT
typical symptoms. Typical diagnosis: it's your code.
I did some tests a while back on this issue when it first started to show
its ugly head. In some rear instances, memory spikes can overwhelm the
process resulting in exceptions. Coupled with the VLO bug, it can certainly
seem like it is a system issue. However, most of the times the issues can be
resolved by being smart about memory allocation.

Signature

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------

> Hi All,
>
[quoted text clipped - 12 lines]
> Thanks
> Kevin
Ted Harper - 11 Dec 2005 04:04 GMT
>We are having problems with OutOfMemoryExceptions in our hosting
>environment.
[quoted text clipped - 7 lines]
>Task manager shows ~650MB of physical memory free so why is ASP.NET not
>able to allocate any more memory?

See the MSDN article
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/mon
itor_perf.asp

and specifically the "Private Bytes" section where it describes a
situation where you may receive an OutOfMemoryException where the
memory is clearly not used-up.

There is also a section "Configure the Memory Limit" in
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/scal
enetchapt17.asp

which covers the same ground and might be helpful too.

Hope this helps,
ted.h.
Signature

Ted Harper (Sydney, Australia)

Frank Samuel - 20 Dec 2005 14:24 GMT
I've seen the same thing where the virtual memory was very fragmented
(millions of unmanaged blocks held everywhere, so .NET was not able to get a
continous 64MByte block).
DebugDiag helped me to track this problem down.

Frank

> Hi All,
>
[quoted text clipped - 12 lines]
> Thanks
> Kevin
zq - 20 Dec 2005 15:39 GMT
Hi!

task manager's "memory usage" should be taken with care. it is actually the
working set of the process, which represents amount of physical memory
available to the process at a runtime, but it doesn't mean it is used by the
process.

In .net, this memory is not trimmed to it's actual size until garbage
collection occurs.
You can initiate that manually by calling GC.Collect();, but it is not
recommended or
necessary.

once when another process requests for some memory, windows trim the
process' working set to it's actual size. You can try that by observing any
application's
"memory usage" before and after you minimize it (e.g. MS Outlook). You'll
see that it
reduces when minimized.

You can also implement that in your app by calling kernel32.dll's
SetProcessWorkingSetSize with min working set size and max working set size
parameters set to -1
But it is not necessary.

task manager's "VM size" (you'll have to add that column if you don't see
it) represents
process "private bytes", which means absolute number of bytes occupied by
the
process - this is where you should focus your search. This is important,
because once
this counter reaches your pagefile size (minus amount of memory occupied by
other running apps)
you will start getting OutOfMemory exceptions.

What you really wanna try is checking your code to see if you have any
non-disposed
objects adding up in your code.

That is - of course - if you have the code of the web-service /
web-application.

> I've seen the same thing where the virtual memory was very fragmented
> (millions of unmanaged blocks held everywhere, so .NET was not able to get
[quoted text clipped - 19 lines]
>> Thanks
>> Kevin

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.