X
xtravar
I was having trouble tracking down a memory leak in my application, and
after a lot of mucking around I found out that some objects that
inherit from UserControl were not being finalized. Now, there were no
references to these objects... I know this for sure. Multiple calls to
the GC had no effect, either.
I found that UserControl's Dispose() method must be calling
GC.SuppressFinalize(this)...
This code does not work:
GC.ReRegisterForFinalize(this);
base.Dispose();
This code works (the object is Finalized):
base.Dispose();
GC.ReRegisterForFinalize(this);
Is this a bug, or does this behavior serve some sort of purpose? Has
anyone else experienced this? Can someone from Microsoft confirm or
deny this?
Compact Framework 2.0, Visual Studio 2005, testing on an iPAQ.
after a lot of mucking around I found out that some objects that
inherit from UserControl were not being finalized. Now, there were no
references to these objects... I know this for sure. Multiple calls to
the GC had no effect, either.
I found that UserControl's Dispose() method must be calling
GC.SuppressFinalize(this)...
This code does not work:
GC.ReRegisterForFinalize(this);
base.Dispose();
This code works (the object is Finalized):
base.Dispose();
GC.ReRegisterForFinalize(this);
Is this a bug, or does this behavior serve some sort of purpose? Has
anyone else experienced this? Can someone from Microsoft confirm or
deny this?
Compact Framework 2.0, Visual Studio 2005, testing on an iPAQ.