public void Dispose() { var count = checked ((int)Array.Count.ToUInt32()); for (int i = 0; i < count; i++) { EncodingMarshaler.Cleanup(Marshal.ReadIntPtr(Array.Strings, i * IntPtr.Size)); } if (Array.Strings != IntPtr.Zero) { Marshal.FreeHGlobal(Array.Strings); } // Now that we've freed the memory, zero out the structure. Array.Reset(); }
public void Dispose() { if (size == 0) { return; } var count = (int)size; var pointers = new IntPtr[count]; Marshal.Copy(strings, pointers, 0, count); for (int i = 0; i < count; i++) { EncodingMarshaler.Cleanup(pointers[i]); } Marshal.FreeHGlobal(strings); size = 0; }
public void Dispose() { EncodingMarshaler.Cleanup(WorkDirPath); WorkDirPath = IntPtr.Zero; }