Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Memory Leaks in ASP.NET

Reply
Thread Tools

Memory Leaks in ASP.NET

 
 
=?Utf-8?B?RnJhbmsxMjEz?=
Guest
Posts: n/a
 
      03-04-2005
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.
 
Reply With Quote
 
 
 
 
Scott Allen
Guest
Posts: n/a
 
      03-04-2005
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
<(E-Mail Removed)> 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.


 
Reply With Quote
 
 
 
 
Homam
Guest
Posts: n/a
 
      03-04-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
> <(E-Mail Removed)> 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.

>



 
Reply With Quote
 
=?Utf-8?B?RnJhbmsxMjEz?=
Guest
Posts: n/a
 
      03-04-2005
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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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
> > <(E-Mail Removed)> 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.

> >

>
>
>

 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      03-04-2005
"Frank1213" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> 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?


 
Reply With Quote
 
Josh
Guest
Posts: n/a
 
      03-04-2005
Its not likely to be the fault of the string. I bet its the Reader not
cleaning up. Try killing the reader.


"Frank1213" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.



 
Reply With Quote
 
=?Utf-8?B?RnJhbmsxMjEz?=
Guest
Posts: n/a
 
      03-04-2005
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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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.

>
>
>

 
Reply With Quote
 
=?Utf-8?B?RnJhbmsxMjEz?=
Guest
Posts: n/a
 
      03-04-2005
Yes. We used the same one. I am not aware of something better than this.

"Mark Rae" wrote:

> "Frank1213" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>
> > 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?
>
>
>

 
Reply With Quote
 
Kevin Spencer
Guest
Posts: n/a
 
      03-04-2005
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" <(E-Mail Removed)> wrote in message
news(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > 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.

>>
>>
>>



 
Reply With Quote
 
david youren
Guest
Posts: n/a
 
      03-11-2005
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!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Our memory leaks? James Hunter Ross ASP .Net 2 10-20-2005 08:25 PM
ASP.NET - Detecting memory leaks ASP.Confused ASP .Net 2 07-16-2004 04:24 PM
Re: Memory Leaks & Strings Jon Skeet Java 0 07-30-2003 02:47 PM
memory leaks with firebird? astromannix Firefox 2 07-26-2003 12:10 AM
do self references cause memory leaks in Java? Novice Java 28 07-22-2003 02:25 PM



Advertisments