Beispiel #1
0
        /** <inheritdoc /> */
        public override void Reallocate(int cap)
        {
            // Try doubling capacity to avoid excessive allocations.
            int doubledCap = PlatformMemoryUtils.GetCapacity(Pointer) << 1;

            if (doubledCap > cap)
            {
                cap = doubledCap;
            }

            PlatformMemoryPool.Reallocate(Pointer, cap);
        }
Beispiel #2
0
 /** <inheritdoc /> */
 public override void Release()
 {
     PlatformMemoryPool.Release(Pointer); // Return to the pool.
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="pool">Pool.</param>
 /// <param name="memPtr">Memory pointer.</param>
 public PlatformPooledMemory(PlatformMemoryPool pool, long memPtr) : base(memPtr)
 {
     this._pool = pool;
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="pool">Pool.</param>
 /// <param name="memPtr">Memory pointer.</param>
 public PlatformPooledMemory(PlatformMemoryPool pool, long memPtr)
     : base(memPtr)
 {
     this._pool = pool;
 }