Dispose, Finalizer, = null, Dead references

D

Daniel K.

I have a form derived mdi child with a private field that holds the
instance of a business class. As i noticed, this business object stays
until the program (which in fact is the parent form) exits, no matter
how many times i call GC.Collect(). if i explicitly call
"m_businessObject = null" in the Dispose() override, it seems to work,
but that can't be right to explicitly set references of managed
classes to null in the dispose method? The class itself in that case
was never even references somewhere (besides in a weakreference[] list
to test it). seems to be no difference in debug and release mode. any
suggestions?

Thx in advance,
Daniel K
 
V

ViperDK \(Daniel K.\)

Is there any way to trace the object's graph and find out why the object
still is still in it?

Daniel Jin said:
well, if an object is reachable in the object graph, (in your case, a
private field of a long lived form), it's not garbage, and it won't be
collected.
 
D

Daniel K.

Finally i found it out after giving a try to "Memory Profiler". When a
control on any page was databound, that however causes a graph to the
DataSource it is bound to. hopefully it will be fixed in a future
version. absolutely relying on a prober reset of the databinding
controls in the dispose function kind a scares me.
 
D

Daniel K.

Finally i found it out after giving a try to "Memory Profiler". When a
control on any page was databound, that however causes a graph to the
DataSource it is bound to. hopefully it will be fixed in a future
version. absolutely relying on a prober reset of the databinding
controls in the dispose function kind a scares me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top