Memory Leaks in ASP.NET

G

Guest

In my ASP.NET application, we are noticing appreciable memory leaks and the
main culprit appears to be System.String We use ResourceReader to read in a
resource file and we close and dispose the resourcereader object also. We
profiled the application using .NET Memory profiler and it appears that
garbage collection does not appear to be happening. Even after closing all
sessions memory for aspnet process remains pegged at the level it was.
Has anyone run across a similar situation? Any ideas would be greatly
appreciated.
 
S

Scott Allen

So the application leaks? Or it stays at a farily predictable 'high
water' mark?
 
G

Guest

Thanks to both of you for your replies.
at one of our client sites the application virtually became unusable pegging
the memory over 800 MB. In our tests with .NET Memory profiler the culprit
appears to be System.String when used with ResourceReader. Our tests also
indicated that even after all the sessions are closed the aspnet memory
remained high and never came down even after about 6 hours.
 
J

Josh

Its not likely to be the fault of the string. I bet its the Reader not
cleaning up. Try killing the reader.
 
K

Kevin Spencer

I agree with Josh. System.String is not going to cause any memory leaks. If
you abuse it, it can run your memory up quite a bit, but it will come back
down. On the other hand, ResourceReader is a disposable class that works
with files. Not closing and/or disposing such a class can cause a memory
leak.

Now, I know that you've stated that you close and dispose the
ResourceReader, but are you sure that you always do so? For example, is the
close and dispose in a Finally block of a Try/Catch block? If not, an
exception might prevent the ResourceReader from being disposed properly.

You might want to look for any other classes that expose unmanaged objects,
particularly classes that work with File IO.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
D

david youren

I have a similar problem with a memory leak in .net on a dual xeon
windows 2003 server. I notice a lot of posts about this leaks on a dual
xeon, what is your server running?
 
Joined
May 28, 2009
Messages
2
Reaction score
0
=?Utf-8?B?RnJhbmsxMjEz?= said:
In my ASP.NET application, we are noticing appreciable memory leaks and the
main culprit appears to be System.String We use ResourceReader to read in a
resource file and we close and dispose the resourcereader object also. We
profiled the application using .NET Memory profiler and it appears that
garbage collection does not appear to be happening. Even after closing all
sessions memory for aspnet process remains pegged at the level it was.
Has anyone run across a similar situation? Any ideas would be greatly
appreciated.


Hi,

we are also facing the problem of memory leak. actually this is because of the infragistics tools for ASP.net. I am also using .net Memory Profile but since I new to this tool, need some resources which could give me insite of the tool. the resouces/material/samples available on the .net memory profiler's site are for win App.

will appreciate if you could provide something regarding this.
 
Joined
Nov 7, 2012
Messages
2
Reaction score
0
Asp.Net Web Profiler

In my ASP.NET application, we are noticing appreciable memory leaks and the
main culprit appears to be System.String We use ResourceReader to read in a
resource file and we close and dispose the resourcereader object also. We
profiled the application using .NET Memory profiler and it appears that
garbage collection does not appear to be happening. Even after closing all
sessions memory for aspnet process remains pegged at the level it was.
Has anyone run across a similar situation? Any ideas would be greatly
appreciated.

I only recently dicovered the Asp.Net Web Profiler. It is simply amazing in how you can analize in memory data. It displays the asp.net cache data, application state data and objects, all active user sessions and al session state data in each session with drill down functionality to browse through data and analyze everything.
 
Joined
Nov 7, 2012
Messages
2
Reaction score
0
Web Profiler

In my ASP.NET application, we are noticing appreciable memory leaks and the
main culprit appears to be System.String We use ResourceReader to read in a
resource file and we close and dispose the resourcereader object also. We
profiled the application using .NET Memory profiler and it appears that
garbage collection does not appear to be happening. Even after closing all
sessions memory for aspnet process remains pegged at the level it was.
Has anyone run across a similar situation? Any ideas would be greatly
appreciated.

If there are still something running in memory you should be able to detect it by running the asp.net web profiler. You can download for free from aspwebprofiler.com
 

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,704
Messages
2,569,334
Members
44,617
Latest member
ConcettaTa

Latest Threads

Top