Figuring out memory leak
Zin
Posts: 5
Hi,
I'm new to memory leak detection in C# and Ants Memory Profiler. I found a few objects that I believe should have been released after GC.Collect() is called but they still show up in Ants profiler as being alive.
Do I have a memory leak and how do I figure out which one(s) causes the leak for this situation:
If A holds references to X1,X2,...Xn;
X1 holds references to X1a, X1b, X1c...X1z
X2 holds references to X2a, X2b, X2c...X2z
A is reported still alive and nobody holds references to it.
In my case A is Hashtable+HashtableEnumerator
Thank you very much.
I'm new to memory leak detection in C# and Ants Memory Profiler. I found a few objects that I believe should have been released after GC.Collect() is called but they still show up in Ants profiler as being alive.
Do I have a memory leak and how do I figure out which one(s) causes the leak for this situation:
If A holds references to X1,X2,...Xn;
X1 holds references to X1a, X1b, X1c...X1z
X2 holds references to X2a, X2b, X2c...X2z
A is reported still alive and nobody holds references to it.
In my case A is Hashtable+HashtableEnumerator
Thank you very much.
This discussion has been closed.
Comments
This is a difficult question to answer without knowing the application and what it's been doing. If you want, you can send the profiler results to us at support@red-gate.com and we can try to have a look and offer some suggestions for you.
Give me until tomorrow and I will set up a private FTP account for you on our FTP server.
If you're still interested, I've set up an FTP directory for you. Your username and password have been sent via email.
The starting point is normally to look at the 'all objects' tab and find the number of objects that have been allocated and compare that to the live count.
'live' means the object is referenced and cannot be collected, right? how if an object is already out of calling range, such as a private string?
As far as I'm aware, a live object is an object which still has a pointer to it on the program's stack. I'm sure it's more complex than that, though.