Class DisposableObject
Represents a class which manages its own memory.
Inheritance
Namespace: OpenCvSharp
Assembly: OpenCvSharp.dll
Syntax
public abstract class DisposableObject : IDisposable
Constructors
| Improve this Doc View SourceDisposableObject()
Default constructor
Declaration
protected DisposableObject()
DisposableObject(Boolean)
Constructor
Declaration
protected DisposableObject(bool isEnabledDispose)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isEnabledDispose | true if you permit disposing this class by GC |
Properties
| Improve this Doc View SourceAllocatedMemory
Gets or sets a memory address allocated by AllocMemory.
Declaration
protected IntPtr AllocatedMemory { get; set; }
Property Value
Type | Description |
---|---|
IntPtr |
AllocatedMemorySize
Gets or sets the byte length of the allocated memory
Declaration
protected long AllocatedMemorySize { get; set; }
Property Value
Type | Description |
---|---|
System.Int64 |
DataHandle
Gets or sets a handle which allocates using cvSetData.
Declaration
protected GCHandle DataHandle { get; }
Property Value
Type | Description |
---|---|
System.Runtime.InteropServices.GCHandle |
IsDisposed
Gets a value indicating whether this instance has been disposed.
Declaration
public bool IsDisposed { get; protected set; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsEnabledDispose
Gets or sets a value indicating whether you permit disposing this instance.
Declaration
public bool IsEnabledDispose { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
| Improve this Doc View SourceAllocGCHandle(Object)
Pins the object to be allocated by cvSetData.
Declaration
protected GCHandle AllocGCHandle(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Runtime.InteropServices.GCHandle |
AllocMemory(Int32)
Allocates the specified size of memory.
Declaration
protected IntPtr AllocMemory(int size)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | size |
Returns
Type | Description |
---|---|
IntPtr |
Dispose()
Releases the resources
Declaration
public void Dispose()
Dispose(Boolean)
Releases the resources
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | If 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
Declaration
protected virtual void DisposeManaged()
DisposeUnmanaged()
Releases unmanaged resources
Declaration
protected virtual void DisposeUnmanaged()
Finalize()
Destructor
Declaration
protected void Finalize()
NotifyMemoryPressure(Int64)
Notifies the allocated size of memory.
Declaration
protected void NotifyMemoryPressure(long size)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | size |
ThrowIfDisposed()
If this object is disposed, then ObjectDisposedException is thrown.
Declaration
public void ThrowIfDisposed()