473,413 Members | 1,993 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

Memory Leaks in ASP.NET

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.
Nov 19 '05 #1
9 1197
So the application leaks? Or it stays at a farily predictable 'high
water' mark?

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Thu, 3 Mar 2005 16:45:02 -0800, Frank1213
<Fr*******@discussions.microsoft.com> wrote:
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.


Nov 19 '05 #2
You need be very careful with String objects as you could easily end up
creating a large number of intermediate junk objects. In most cases, a
reusable StringBuilder used as a buffer is a better choice.

Check:
http://msdn.microsoft.com/library/en...hapt05_topic26


"Scott Allen" <sc***@nospam.odetocode.com> wrote in message
news:3r********************************@4ax.com...
So the application leaks? Or it stays at a farily predictable 'high
water' mark?

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Thu, 3 Mar 2005 16:45:02 -0800, Frank1213
<Fr*******@discussions.microsoft.com> wrote:
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.

Nov 19 '05 #3
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.

"Homam" wrote:
You need be very careful with String objects as you could easily end up
creating a large number of intermediate junk objects. In most cases, a
reusable StringBuilder used as a buffer is a better choice.

Check:
http://msdn.microsoft.com/library/en...hapt05_topic26


"Scott Allen" <sc***@nospam.odetocode.com> wrote in message
news:3r********************************@4ax.com...
So the application leaks? Or it stays at a farily predictable 'high
water' mark?

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Thu, 3 Mar 2005 16:45:02 -0800, Frank1213
<Fr*******@discussions.microsoft.com> wrote:
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.


Nov 19 '05 #4
"Frank1213" <Fr*******@discussions.microsoft.com> wrote in message
news:ED**********************************@microsof t.com...
We profiled the application using .NET Memory Profiler


You mean this one: http://www.scitech.se/memprofiler/

Can you recommend it? Is anyone else using it? Is there a better utility out
there?
Nov 19 '05 #5
Its not likely to be the fault of the string. I bet its the Reader not
cleaning up. Try killing the reader.
"Frank1213" <Fr*******@discussions.microsoft.com> wrote in message
news:ED**********************************@microsof t.com...
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.

Nov 19 '05 #6
We in fact Close,Dispose and even set the reader to null.

"Josh" wrote:
Its not likely to be the fault of the string. I bet its the Reader not
cleaning up. Try killing the reader.
"Frank1213" <Fr*******@discussions.microsoft.com> wrote in message
news:ED**********************************@microsof t.com...
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.


Nov 19 '05 #7
Yes. We used the same one. I am not aware of something better than this.

"Mark Rae" wrote:
"Frank1213" <Fr*******@discussions.microsoft.com> wrote in message
news:ED**********************************@microsof t.com...
We profiled the application using .NET Memory Profiler


You mean this one: http://www.scitech.se/memprofiler/

Can you recommend it? Is anyone else using it? Is there a better utility out
there?

Nov 19 '05 #8
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.

"Frank1213" <Fr*******@discussions.microsoft.com> wrote in message
news:DC**********************************@microsof t.com...
We in fact Close,Dispose and even set the reader to null.

"Josh" wrote:
Its not likely to be the fault of the string. I bet its the Reader not
cleaning up. Try killing the reader.
"Frank1213" <Fr*******@discussions.microsoft.com> wrote in message
news:ED**********************************@microsof t.com...
> 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.


Nov 19 '05 #9
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?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Maurice | last post by:
Hi there, I'm experiencing big memory problems on my webserver. First on an old RedHat 7.2 system, now on an other fresh installed Suse 8.2 system: Linux version 2.4.20-4GB...
0
by: Steve Binney | last post by:
My code makes synchronous HttpWebRequest and HttpRebResponse calls. In VS 2003, I am getting memory leaks and event handle leaks. I am closing all streams and using "using"statements. I have...
4
by: Morten Aune Lyrstad | last post by:
Ok, now I'm officially confused. I have a large project going, which uses a win32 ui library I am developing myself. And I'm getting weird memory leaks. I don't know if I can explain what is going...
2
by: Generic Usenet Account | last post by:
I have been using STL for a long time now, without any problems. Recently we generated a purification report on our software using Rational Purify, and we found some memory leaks. My colleague...
8
by: ranjeet.gupta | last post by:
Dear All Is the Root Cause of the Memory corruption is the Memory leak, ?? suppose If in the code there is Memory leak, Do this may lead to the Memory Corruption while executing the program ? ...
0
by: Frank Lopez | last post by:
Does anyone know if Microsoft generated a whitepaper on this topic? Does anyone know what the solution is? (meaning, eliminate the leak problem -- I am seeing three memory leaks from...
4
by: ali.jan | last post by:
Hi, It is trivial to load an assembly in a new Application Domain. Is there any way of loading an assembly in a new process? I tried using the Process class like this: Process p = new...
23
by: James | last post by:
The following code will create memory leaks!!! using System; using System.Diagnostics; using System.Data; using System.Data.SqlClient; namespace MemoryLeak
3
by: Jim Land | last post by:
Jack Slocum claims here http://www.jackslocum.com/yui/2006/10/02/3-easy-steps-to-avoid-javascript- memory-leaks/ that "almost every site you visit that uses JavaScript is leaking memory". ...
16
by: graham.keellings | last post by:
hi, I'm looking for an open source memory pool. It's for use on an embedded system, if that makes any difference. Something with garbage collection/defragmentation would be nice. It should have...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.