Let's say I'm implementing some wrapper class Foo
in C++/CLI. Naturally if I'll create a dtor (Foo::~Foo
), it'll become an IDisposable
implementation.
IDisposable is typically used to allow immediate release of some "scarce" resource: GDI resources, file handles etc. However, if my IDisposable simply frees memory (e.g. it simply performs free
or delete
), shouldn't it be done in a regular finalizer (Foo::!Foo
), whenever that happens?
I mean, we're okay with the idea that .NET frees memory whenever it likes to, so why give granular control over something that's essentially just freeing memory?