예제 #1
0
        protected override void Dispose(bool p_Disposing)
        {
            if (p_Disposing)
            {
                GC.SuppressFinalize(this);
            }
            else
            {
                // We're being finalized.
                if (AppDomain.CurrentDomain.IsFinalizingForUnload())
                {
                    // If we're being finalized because of a shutdown, don't go any further.
                    // We have no idea what's already been cleaned up.
                    base.Dispose(p_Disposing);
                    return;
                }
            }

            foreach (PooledMemoryStreamDataBlock l_DataBlock in m_DataBlocks)
            {
                l_DataBlock.SourceBlock.ReturnBlock();
            }

            m_DataBlocks.Clear();

            m_StreamManager = null;
            m_DataBlocks    = null;

            base.Dispose(p_Disposing);
        }
예제 #2
0
 public PooledMemoryStream(long p_Capacity, PooledMemoryStreamManager p_StreamManager)
 {
     m_StreamManager  = p_StreamManager;
     m_DataBlocks     = new List <PooledMemoryStreamDataBlock>();
     m_AccessBlock    = new PooledMemoryStreamDataBlock();
     m_BlockAndOffset = new PooledMemoryStreamBlockAndOffset();
     EnsureCapacity(p_Capacity);
 }