Generic Memory Management

J

James

I realize the Garbage Collector does a lot of this for me, but I'm having
trouble wrapping my head around something. We've been running into
System.OutOfMemoryException on our production servers running ASP.NET
1.1.4322. It's very intermittent and I don't know exactly what's causing
it. We do use a lot of a Session variables in our application and I'm
wondering if it's possible that when our load is the heaviest, if we're
storing large datasets in Session memory, that could be the cause.

From what I can gather, I don't have the ability to dispose of memory
allocated for Session variables explicitly. So assuming that our
application requires this design, how do I avoid this problem, assuming it
IS the problem in the first place?
 
B

bruce barker

out of memory has two common causes.

1) "leaking" unmanaged memory. not calling dispose on .net classes that
use unmanaged memory. not a true leak, but in practice has the same effect.

2) using too much memory. asp.net has a max memory size (can be
reconfigured, actual max depends on server and o/s).

look at memory status to see if unmanaged memory is growing or just
managed. if managed is too high, move session data to cache (will be
thrown out if memory gets high) or switch to sqlserver sessions, a good
idea for high volume sites.

-- bruce (sqlwork.com)
 
J

James

Thanks for the reply. I'm a neophyte when it comes to monitoring memory for
ASP.NET applications. What's the best tool? I attempted to install the
Windbg app from msdn (I believe) and it keeps hanging on me during the
install. I'm not entirely certain I'd know what I was looking at anyway.

A tangent question. I created a simple .NET application where I query a SQL
database and load a large DataSet into a variable. I use this same query
and fill 3 different datasets and then close the application. Locally,
aspnet_wp.exe goes up by several MB in terms of "Mem Usage" and "VM Size" in
taskmgr, which I know isn't the best tool. But even after it closes, this
memory isn't freed more than an hour later.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top