An OutOfMemoryException means that you ran out of space in the heap, not
that you have no memory available on the machine. When you create a new
object, the CLR makes a request for a contiguous block of memory in the
managed heap. It does this by checking the pointer for the next object on
the heap and then determining if there is enough memory on the heap for the
new object you are creating. If there is no memory available on the heap
(we're talking contiguous memory) and there are no objects that can be
collected to free contiguous space, you will receive an
OutOfMemoryException.
The garbage collector will compact memory as necessary when it collects
objects in order to keep as much free contiguous memory available in the
heap, but if you have large objects in the heap (objects that are over 85K)
and you're running ASP.NET 1.0, the heap won't be compacted. If you are
running ASP.NET 1.1, we have a new generation (generation 3), and gen3 is
only for large objects. Gen3 does get compacted, but very rarely.
Bear in mind that an object is only going to be collected and the
associated heap compacted if the object is not rooted.
You could also be running into a native leak somewhere. If that's the
case, when the CLR attempts to get another 64K block of memory for the
heap, it cannot.
The only way to determine for sure what is causing this is by getting a
memory dump and examing it in a debugger to see what's going on.
Jim Cheshire, MCSE, MCSD [MSFT]
ASP.NET
Developer Support
jame...@online.microsoft.com
This post is provided "AS-IS" with no warranties and confers no rights.
--------------------
>Thread-Topic: loads of memory and system.outofmemoryexception error
>thread-index: AcQYJ5DiBjUprCHITwCpEvG5Ox4b5Q==
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.caching
>From: =?Utf-8?B?RGFycmVu?= <anon...@discussions.microsoft.com>
>Subject: loads of memory and system.outofmemoryexception error
>Date: Thu, 1 Apr 2004 12:26:08 -0800
>Lines: 9
>Message-ID: <16A51313-F4BB-4D8C...@microsoft.com>
>MIME-Version: 1.0
>Content-Type: text/plain;
> charset="Utf-8"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>Content-Class: urn:content-classes:message
>Importance: normal
>Priority: normal
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
>Newsgroups: microsoft.public.dotnet.framework.aspnet.caching
>Path: cpmsftngxa06.phx.gbl
>Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.aspnet.caching:2305
>NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.caching
>
>Hi, can anyone offer advise on this server error.
I am getting asp "system.outofmemoryexception" on our production
environment. The server is a brand new box with 3Gb DDR RAM and loads of
HDD space. What we do (for performance and because we have a large but
almost completely static data set) is to load the data into Application
cache when the website is launched. This then stays in cache for all
users.
The problem is that I get the error when we have only loaded 1Gb of data,
are are not even into swap space. Can anyone offer advice? I have set the
usable memory to 85% in the machine config file if that helps.
Many thanks for any comments.
Darren
>
You can download the Debugging Tools for Windows at this location:
http://www.microsoft.com/whdc/ddk/debugging/installx86.mspx
Included in this toolkit is adplus, a VBScript file that will allow you to
attach the debugger (cdb) to the aspnet_wp.exe process. By default, adplus
will only allow you to get a dump when a crash occurs or manually via hang
mode. In your case, you'd need one at the moment that the
OutOfMemoryException occurs . You can do that by setting a breakpoint via
a configuration file, but first you have to know the token number of the
exception in the version of mscorwks.dll or mscorsvr.dll.
After you get the dump, you open it in WinDbg, another tool that is part of
the debugging tools. WinDbg is designed to be a native debugger, but you
can (assuming you're using the 1.1 version of the Framework) use SOS, and
extension to WinDbg that ships with the .NET Framework, to debug managed
code. After you've loaded SOS, you can use !help for a list of the
commands that you can run.
Keep in mind that analyzing a dump like this requires experience in doing
so and can sometimes take several hours. It's not something that is
intuitive. You have to know how to do it. Unless you have someone there
who is experienced in post-mortem debugging, the best way to isolate these
kinds of issues is to contact us. We can assist you in getting a dump
created and will then analyze it for you.
Jim Cheshire, MCSE, MCSD [MSFT]
ASP.NET
Developer Support
jame...@online.microsoft.com
This post is provided "AS-IS" with no warranties and confers no rights.
--------------------
>Thread-Topic: loads of memory and system.outofmemoryexception error
>thread-index: AcQZDKiYO+98pMvdT7SZasdiWD1tVg==
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.caching
>From: =?Utf-8?B?RGFycmVu?= <anon...@discussions.microsoft.com>
>References: <16A51313-F4BB-4D8C...@microsoft.com>
<POz4HhD...@cpmsftngxa06.phx.gbl>
>Subject: RE: loads of memory and system.outofmemoryexception error
>Date: Fri, 2 Apr 2004 15:46:03 -0800
>Lines: 9
>Message-ID: <BDAAF1B1-5C5E-4F5E...@microsoft.com>
>MIME-Version: 1.0
>Content-Type: text/plain;
> charset="Utf-8"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>Content-Class: urn:content-classes:message
>Importance: normal
>Priority: normal
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
>Newsgroups: microsoft.public.dotnet.framework.aspnet.caching
>Path: cpmsftngxa06.phx.gbl
>Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.aspnet.caching:2316
>NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.caching
>
>Jim,
thanks a lot for taking the time to reply.
We are loading a lot into memory and it is possible that we are hitting the
1Gb limit for a single process. I have attempted to get around this with
the /3GB boot switch and avoid the problem by slimming down the objects
that we are caching. Could you go into a little more detail about loading
the memory dump into the debugger?
Regards
Darren
>