public virtual void Dispose()
{
if (!IsDisposed)
{
// Set the flag to true
IsDisposed = true;
// Release the allocated memory
Release();
// Remove this object from the collection of allocated memory
MemorySharp.Memory.Deallocate(this);
// Remove the pointer
BaseAddress = IntPtr.Zero;
// Avoid the finalizer
GC.SuppressFinalize(this);
}
}