473,659 Members | 3,494 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1207
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*******@disc ussions.microso ft.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.o detocode.com> wrote in message
news:3r******** *************** *********@4ax.c om...
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*******@disc ussions.microso ft.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.o detocode.com> wrote in message
news:3r******** *************** *********@4ax.c om...
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*******@disc ussions.microso ft.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*******@disc ussions.microso ft.com> wrote in message
news:ED******** *************** ***********@mic rosoft.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*******@disc ussions.microso ft.com> wrote in message
news:ED******** *************** ***********@mic rosoft.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*******@disc ussions.microso ft.com> wrote in message
news:ED******** *************** ***********@mic rosoft.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*******@disc ussions.microso ft.com> wrote in message
news:ED******** *************** ***********@mic rosoft.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*******@disc ussions.microso ft.com> wrote in message
news:DC******** *************** ***********@mic rosoft.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*******@disc ussions.microso ft.com> wrote in message
news:ED******** *************** ***********@mic rosoft.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
16682
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 (root@Pentium.suse.de) (gcc version 3.3 20030226 (prerelease) (SuSE Linux)) #1 Wed Aug 6 18:26:21 UTC 2003 Apache 1.3.27-41 PHP 4.3.1-52 MySQL 3.23.55-20
0
1864
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 used .Net memory profiler from Sci Tech to analyze the leaks and they are coming from inside HttpWebRequest and HttpRebResponse. When I run my code on VS2005, I do not get any leaks. Is this problem fixed in .Net 1.1 SP1? I may not be able to wait...
4
2347
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 on, but I really need some help on this one. Ok, so I have this class defined (written by Randy Charles Morin, www.kbcafe.com) which detects memory leaks. It creates a memory check point in the constructor, and another in the destructor, and...
2
4950
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 claims that some of the memory leaks are due to the fact that "STL is wrought with memory leaks". Of course I disagree. I think that there are no "inherent leaks" with STL, but if used improperly, leaks will occur. One common source of leak that...
8
3408
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 ? In nut shell, what is/are the realtion/s between the Memory Leak and Memory Corruption. Juts Theoritical Assumtion below:
0
3899
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 dllmodul.cpp(102) similar to what is mentioned below)... I am calling MFC as part of unmanaged code used by the managed code. +--------
4
5705
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 Process() p.StartInfo.FileName = mStartupFile p.StartInfo.UseShellExecute = False
23
4545
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
5311
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". Anybody know anything about this? Does *Javascript* leak memeory, or does the *browser* leak memory?
16
5089
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 the ability to allocate different size chunks of memory not just a single size. It should error check for double free, etc. And it should be usable by a mixture of C and C++ subsystems. If I get that, I'm happy. Thank you very much.
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8337
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8748
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8531
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8628
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6181
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2754
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.