justinstenning / SharedMemory

C# shared memory classes for sharing data between processes (Array, Buffer and Circular Buffer)
https://www.nuget.org/packages/SharedMemory
Other
566 stars 118 forks source link

Missing SupressFinalize in Dispose #35

Closed vpenades closed 5 years ago

vpenades commented 5 years ago

The proper dispose pattern requires a GC.SupressFinalize to prevent the dispose to be called two times:

 public void Dispose()
 {
            Dispose(true);
            GC.SuppressFinalize(this);
 }

 protected virtual void Dispose(bool disposeManagedResources)
 {
            if (disposeManagedResources)
            {
                this.Close();
            }
 }