A starter question on analyze memory profile, thanks
wyx2000
Posts: 20
I am trying ANTS profiler. But haven't got the idea how to use it. After take snapshot, I see many objects, but I am not sure if they are all objects that are created so far, if they are all objects that were created, how can I tell from them which ones are the ones that causes problem?
For example, I have a gridview, it has 100 rows, on each rows, several usercontrols will be shown in several columns. After I call the page, should I see objects of all those usercontrols? how do I tell they will be collected by GC or they will not be since they have reference on them? I tried to click "Force GC", I thought after this, and then I take another snapshot, which remain in the all objects should be only those objects that can not be collected by GC, if they are not designed to be reminded in memory, they should be the problematic ones? but I did find much change after I click "Force GC".
Can anyone give me some idea here?
thanks!
For example, I have a gridview, it has 100 rows, on each rows, several usercontrols will be shown in several columns. After I call the page, should I see objects of all those usercontrols? how do I tell they will be collected by GC or they will not be since they have reference on them? I tried to click "Force GC", I thought after this, and then I take another snapshot, which remain in the all objects should be only those objects that can not be collected by GC, if they are not designed to be reminded in memory, they should be the problematic ones? but I did find much change after I click "Force GC".
Can anyone give me some idea here?
thanks!
Comments
ANTS Profiler does force a garbage collection every time a snapshot is taken, so it's really not necessary to use the force GC button. The only exception to this is objects that are pending finalization, which can take at least two GC collections to be disposed of.
Obviously, memory profiling is a HUGE topic and I don't think I could cover it all in one reply. The essence of it is that you are looking for, first, classes with the most live instances and secon, the largest live objects. Classes with many live instances can be live for many reasons, the previously mentioned waiting for finalization, or because they are attached to a live root object.
You may want to have a look at the ANTS Profiler technical papers section; there is some information that may help.
I have read some article about ANTS profiler.
So if the same webpage, in normal case, when I refresh a web page, I should not see any new object in my namespace, right? unless I have static class in it. Those objects were created to create output for the web page should be collected by GC before taking snapshot. Otherwise it means something is not right and memory will build up and never release, right?