Пример #1
0
 public void Free(IntPtr[] data)
 {
     lock (_bufferManager)
     {
         _bufferManager.Free(data);
     }
 }
Пример #2
0
        public static AutoPtr[] AllocateAuto(this IUnmanagedBufferManager manager, int size)
        {
            var ptrs = manager.Allocate(size);
            var ret  = new AutoPtr[ptrs.Length];

            for (int i = 0; i < ptrs.Length; i++)
            {
                ret[i] = new AutoPtr(ptrs[i], ptr => manager.Free(ptr));
            }

            return(ret);
        }