Comments
1 comment
-
Hello Sean,
.NET's Garbage Collector will not free objects when other objects are holding a reference to them, not even if garbage collection is forced. If it behaved this way it would probably wreak havoc with your program.
You can normally trace the reference up to the root object using ANTS Profiler's hierarchy tab, clicking on the referenced from until you see a yes in the root object column.
Sorry to say, the method for fixing the problem is not clearly defined. It may involve invoking an object's Dispose() method, decrementing an event handler, or closing a network or database connection.
Hopefully this helps you a bit...
Add comment
Please sign in to leave a comment.
I have several classes that are essentially a data record class that gets queued, processed and disposed of. But despite not appearing to be referenced anymore by my program, they still don't get collected, even when forcing a garbage collection.
I am using C# in MSVS2008 and .NET Framework 3.5
Sample class as follows : -
private enum RequestType {APPEND, OVER_WRITE};
private class FileRequest
{
public string strData;
public RequestType reqType;
public FileRequest(string data, RequestType type)
{
strData = data;
reqType = type;
}
}