StrataFrame Forum

Memory leakage

http://forum.strataframe.net/Topic32315.aspx

By Danny Doobay - 11/20/2013

I have a maintenance form with two text boxes and a dropdownlist (See attachment).  All of the controls are bound toBO. Dropdownlist populationType is BusinessObject and it fill the data from amethod.

 

I am using enterprise server and this maintenance form fetchthe data from there.

 

Here is the issue: Before I open the maintenance form memorytaken by the application is 114.6 MB and as soon I open the form it was 127.1and when I close the form it was 120.2 MB. I did this many time to see what ishappening and here are the result:

Before Open ==> ASAP Opened ==> After Closed

114.6 ==> 127.1 ==> 120.2

120.2 ==> 129.8 ==> 123.1

123.1 ==> 126.8 ==> 119.9

119.9 ==> 133.1 ==> 126.1

 

It is happening to all the maintenance form and theapplication becoming a memory

 hog.

 

Is there any way I can fix this?

By Danny Doobay - 11/26/2013

I tried using local database (not using enterprise server) and the result were same.
By Keith Chisarik - 12/26/2013

Where are you seeing this "leak"?, if via Task Manager, you really cant go by that. Garbage collection in .NET by design won't return all the memory taken necessarily until it "needs" it, and the way it decides when it needs it is very complex. If you have identified a "leak" by manually making your code collect and finalize garbage collection or already seen the leak via a memory profiler, then I would look at something in your application that is holding on to a GC root and thus not allowing the garbage collection to execute properly.

I have very recently hunted down what I thought were possibly leaks in SF using ANTS Memory Profiler in a very large and complex application.. and it was my code, not SF.

Hope that helps a bit.


By Trent L. Taylor - 12/26/2013

Just to add to Keith, we spend a fair amount of time sending our code through profilers, such as the .NET Memory Profiler.  Everythign that Keith said was correct in regards to looking at the Task Manager, etc.  Even if you force a garbage collection, the task manager may still not reflect what is really going on.

Tracking down memory leaks is a pain, but the tool that we use most often now is .NET Memory Profiler (http://memprofiler.com/) and you can see what references, handlers, etc. are being left open as well as objects that are not being disposed.  Sometimes it can be a very complicated process to track down the issue, and other times very obvious once you see it in the profiler, but in any case, you need a tool like this to really get to the bottom of it.