I need to use an external assembly that I cannot modify. Suppose that I use a class from that assembly like so:
using (ExternalWidget widget = new ExternalWidget())
{
widget.DoSomething();
}
Each time I call this code, it leaks unmanaged memory. ExternalWidget
implements IDisposable
and I have wrapped it in a using
statement, but ExternalWidget
does not clean up its unmanaged resources.
Since I do not have access to the ExternalWidget
code, I cannot fix this issue the right way. Is there any other way that I can free up the memory resources used by ExternalWidget
?