예제 #1
0
파일: UMat.cs 프로젝트: gxliu/emgucv-code
        /// <summary>
        /// Release all the unmanaged memory associated with this object.
        /// </summary>
        protected override void DisposeObject()
        {
            if (_needDispose && _ptr != IntPtr.Zero)
            {
                UMatInvoke.cvUMatRelease(ref _ptr);
            }

            if (_oclMatAllocator != IntPtr.Zero)
            {
                MatDataAllocatorInvoke.cvMatAllocatorRelease(ref _oclMatAllocator);
            }

            base.DisposeObject();
        }
예제 #2
0
        /// <summary>
        /// Release resource associated with this object
        /// </summary>
        protected override void DisposeObject()
        {
            if (_memoryAllocator != IntPtr.Zero)
            {
                MatDataAllocatorInvoke.cvMatAllocatorRelease(ref _memoryAllocator);
            }

            if (_allocateDataActionPtr != IntPtr.Zero)
            {
                GCHandle.FromIntPtr(_allocateDataActionPtr).Free();
                _allocateDataActionPtr = IntPtr.Zero;
            }
            if (_freeDataActionPtr != IntPtr.Zero)
            {
                GCHandle.FromIntPtr(_freeDataActionPtr).Free();
                _freeDataActionPtr = IntPtr.Zero;
            }

            FreeData();
        }