.net - ASP.NET Website Memory Usage quite high -
I have an ASP.NET website which will be used about 2 GB of physical memory in 3-4 days , Which I feel really spoiled At the moment, I have configured IIS to restart the App Pool process while hitting 500 MB and I would try and track down the problem
A new instance of an object in .NET While making, I was under the impression that it does not need to be free because .NET Garbage collector will do this for me.
Is this the case or can it be one of the reasons for me?
.NET will manage your garbage collection very efficiently while IDisposable
It is wise to call the DISAS
method on the types of implementations, it is probably not your problem, for many reasons the memory leaks can be. Here are some:
- You can cache a lot of data per user in the session.
- You can cache a lot of data at an application level in the application cache or in a static variable like a dictionary.
- You store web controls (or user controls) in session or application level.
- You prevent events occurring on static types or types that are referenced (as they are stored in the cache).
I hope this will tell you some where.
UPDATE: You should see about ASP.NET debugging.
Update 2: The following about your comment on my answer. CLR will collect all managed memory, so whatever object you create using new
will be collected. In this sense, it does not matter whether an object applies to IDisposable
or not, though many times you have access to basic resources (such as file handles, graphic handles, database connection, native -un-used-memory) need to be used directly or indirectly. CLR does not know how to release these resources. For this. The final idea of the net. Finally, there is a virtual system that can implement a class developer. When you do this, CLR will call this method because one example of this type is unreferenced and before collecting it Lastly there are such arguments that these resources are released. In other words, when one type of basic resources are required, then there is usually a final form of it that allows those resources to be released.
What happened in relation to CLR, the story ends here CLR does not have any specific operation of the objects that implement the IDisposable
interface, however, the NAT waste collector in nature Is ignored. This means that you do not know when it runs and if it moves. This means that it can take a very long time before your original resources become clean (because only after gathering the last thing only) will get it. Although for many resources, it is necessary to release them as soon as possible, for example, when you do not close them or when you are working with GDI + in the .NET through the system, Then you exit the database connection.).
For this reason the IDisposable
interface was started. Again, the CLR and the garbage collector do not see this interface. This is an agreement between the type and its users, which allows its users to release the underlying resources of an object directly. In a typical design, the last of the object and the dispose
method of the object will call both private or secure, which will release those resources. When a type of IDisposable
is applied, then it is a code dissection
method when you complete it or by using the statement
statement Let's write down the basic resources to be decisive.
Then returning to your question will be collected by all the managed objects GC, but the original resource will not be so that the type of final method can be applied and those objects are usually IDisposable
You can apply the interface.
I hope this makes sense.
Comments
Post a Comment