Esempio n. 1
0
        /// <summary>
        /// 保存缓冲区
        /// </summary>
        /// <param name="buffer">缓冲区</param>
        public void Push(ref Pointer buffer)
        {
            int size = System.Threading.Interlocked.Exchange(ref buffer.ByteSize, 0);

            if (size != 0)
            {
                if (size == Size)
                {
                    Push((byte *)buffer.GetDataClearOnly());
                }
                else
                {
                    Unmanaged.Free(ref buffer, size);
                }
            }
        }
Esempio n. 2
0
 internal static void FreeStatic(ref Pointer data, int size)
 {
     Marshal.FreeHGlobal((IntPtr)data.GetDataClearOnly());
     Interlocked.Add(ref staticSize, -size);
 }