tags:

views:

748

answers:

3

This is related to another question of mine

After eliminating the obvious (or so I thought) and biggest memory consumer (images in asp.net cache), not much has changed. We use Enterprise Library Exception Handling in this web (don't know why, but we do) and these exceptions do not get logged. Just for the record, server has 4 GB of memory so I do not think that physical memory is the problem.

Here's what happens, according to event log:

First I get this from a page (rarely from a same page twice):

Exception information: 
Exception type: Exception 
Exception message: mscorlib - Exception of type 'System.OutOfMemoryException' was thrown.

Then this:

Description:
An unhandled exception occurred and the process was terminated.
Application ID: /LM/W3SVC/672222825/Root
Process ID: 1544
Exception: System.OutOfMemoryException
Message: Exception of type 'System.OutOfMemoryException' was thrown.
StackTrace:    at System.Threading.ExecutionContext.CreateCopy()
  at System.Threading._TimerCallback.PerformTimerCallback(Object state)

My question is this: how do I use a profiler to see what is causing the crash? I've tried two profilers - .net memory profiler and dotTrace from JetBrains. Memory profiling doesn't really give me anything useful, except that I have a lot of strings. Performance profiling also isn't helping because execution times of functions are all fine and dandy. If this error happens while the profiler is running, it just stops profiling - I'm probably using it wrong.

p.s. Sorry for the formmating, did the best I could.

A: 

I would check that you are calling Dispose on IDisposable implementations. A fairly good way to check that is to run the code through FXCop.

RichardOD
A: 

There is memory limit attribute of the ProcessModel section in the machine.config that governs ASP.NET maximum memory usage before recycling.

Colin
A: 

Problem solved - one of developers was storing whole datatables in session and that ate up the memory (and didn't bother to ask others if it's ok).

Only thing that puzzles me is that it has to crash so ugly instead of throwing YouIdiotYoureOverUsingSessionObjectException :)

Oh well, live and learn...

Vnuk