示例#1
0
        private void InitCursors()
        {
            _endCursor = new GATFixedData(this, "");
            _endCursor.AllocateFree(_mainBuffer.Length, null);

            _unallocatedCursor = new GATManagedData(this);
            _unallocatedCursor.AllocateFree(0, _endCursor);

            _firstCursor = new GATManagedData(this);
            _firstCursor.AllocateFree(0, _unallocatedCursor);
        }
示例#2
0
        /// <summary>
        /// Allocates a fixed chunk of memory.
        /// Fixed chunks cannot be freed, but may be of any size.
        /// For debugging ease, a description is required when requesting
        /// a fixed chunk.
        /// </summary>
        public GATData GetFixedDataContainer(int size, string description)
        {
            if (_unallocatedCursor.MaxSize < size)
            {
                throw new GATException("Out of fixed memory!");
            }

            int          offset;
            GATFixedData ret;

            offset = _endCursor.MemOffset - size;
            ret    = new GATFixedData(this, description);
            ret.AllocateFree(offset, _endCursor.next);
            ret.allocatedSize = size;
            _endCursor.AllocateFree(offset, ret);

            _fixedAllocationsSize += size;
            return(ret);
        }
示例#3
0
        private void InitCursors()
        {
            _endCursor = new GATFixedData( this, "" );
            _endCursor.AllocateFree( _mainBuffer.Length, null );

            _unallocatedCursor = new GATManagedData( this );
            _unallocatedCursor.AllocateFree( 0, _endCursor );

            _firstCursor = new GATManagedData( this );
            _firstCursor.AllocateFree( 0, _unallocatedCursor );
        }
示例#4
0
        /// <summary>
        /// Allocates a fixed chunk of memory.
        /// Fixed chunks cannot be freed, but may be of any size.
        /// For debugging ease, a description is required when requesting
        /// a fixed chunk.
        /// </summary>
        public GATData GetFixedDataContainer( int size, string description )
        {
            if( _unallocatedCursor.MaxSize < size )
            {
                throw new GATException( "Out of fixed memory!" );
            }

            int offset;
            GATFixedData ret;

            offset = _endCursor.MemOffset - size;
            ret = new GATFixedData( this, description );
            ret.AllocateFree( offset, _endCursor.next );
            ret.allocatedSize = size;
            _endCursor.AllocateFree( offset, ret );

            _fixedAllocationsSize += size;
            return ret;
        }