Class DisposableObject
- Namespace
- OpenCvSharp
- Assembly
- OpenCvSharp.dll
Represents a class which manages its own memory.
public abstract class DisposableObject : IDisposable
- Inheritance
-
DisposableObject
- Implements
- Derived
- Inherited Members
Constructors
DisposableObject()
Default constructor
protected DisposableObject()
DisposableObject(bool)
Constructor
protected DisposableObject(bool isEnabledDispose)
Parameters
isEnabledDisposebooltrue if you permit disposing this class by GC
Properties
AllocatedMemory
Gets or sets a memory address allocated by AllocMemory.
protected nint AllocatedMemory { get; set; }
Property Value
AllocatedMemorySize
Gets or sets the byte length of the allocated memory
protected long AllocatedMemorySize { get; set; }
Property Value
DataHandle
Gets or sets a handle which allocates using cvSetData.
protected GCHandle DataHandle { get; }
Property Value
IsDisposed
Gets a value indicating whether this instance has been disposed.
public bool IsDisposed { get; protected set; }
Property Value
IsEnabledDispose
Gets or sets a value indicating whether you permit disposing this instance.
public bool IsEnabledDispose { get; set; }
Property Value
Methods
AllocGCHandle(object)
Pins the object to be allocated by cvSetData.
protected GCHandle AllocGCHandle(object obj)
Parameters
objobject
Returns
AllocMemory(int)
Allocates the specified size of memory.
protected nint AllocMemory(int size)
Parameters
sizeint
Returns
Dispose()
Releases the resources
public void Dispose()
Dispose(bool)
Releases the resources
protected virtual void Dispose(bool disposing)
Parameters
disposingboolIf disposing equals true, the method has been called directly or indirectly by a user's code. Managed and unmanaged resources can be disposed. If false, the method has been called by the runtime from inside the finalizer and you should not reference other objects. Only unmanaged resources can be disposed.
DisposeManaged()
Releases managed resources
protected virtual void DisposeManaged()
DisposeUnmanaged()
Releases unmanaged resources
protected virtual void DisposeUnmanaged()
~DisposableObject()
Destructor
protected ~DisposableObject()
NotifyMemoryPressure(long)
Notifies the allocated size of memory.
protected void NotifyMemoryPressure(long size)
Parameters
sizelong
ThrowIfDisposed()
If this object is disposed, then ObjectDisposedException is thrown.
public void ThrowIfDisposed()