Exemplo n.º 1
0
        private void insertNode(int p, int indx)
        {
            RarNode temp = tempRarNode;

            temp.Address = p;
            temp.SetNext(freeList[indx].GetNext());
            freeList[indx].SetNext(temp);
        }
Exemplo n.º 2
0
        private int removeNode(int indx)
        {
            int     retVal = freeList[indx].GetNext();
            RarNode temp   = tempRarNode;

            temp.Address = retVal;
            freeList[indx].SetNext(temp.GetNext());
            return(retVal);
        }
Exemplo n.º 3
0
 public virtual void stopSubAllocator()
 {
     if (subAllocatorSize != 0)
     {
         subAllocatorSize = 0;
         //ArrayFactory.BYTES_FACTORY.recycle(heap);
         heap      = null;
         heapStart = 1;
         // rarfree(HeapStart);
         // Free temp fields
         tempRarNode      = null;
         tempRarMemBlock1 = null;
         tempRarMemBlock2 = null;
         tempRarMemBlock3 = null;
     }
 }
Exemplo n.º 4
0
        public virtual bool startSubAllocator(int SASize)
        {
            int t = SASize;

            if (subAllocatorSize == t)
            {
                return(true);
            }
            stopSubAllocator();
            int allocSize = t / FIXED_UNIT_SIZE * UNIT_SIZE + UNIT_SIZE;

            // adding space for freelist (needed for poiters)
            // 1+ for null pointer
            int realAllocSize = 1 + allocSize + 4 * N_INDEXES;

            // adding space for an additional memblock
            tempMemBlockPos = realAllocSize;
            realAllocSize  += RarMemBlock.size;

            heap             = new byte[realAllocSize];
            heapStart        = 1;
            heapEnd          = heapStart + allocSize - UNIT_SIZE;
            subAllocatorSize = t;
            // Bug fixed
            freeListPos = heapStart + allocSize;
            //UPGRADE_ISSUE: The following fragment of code could not be parsed and was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1156'"
            //assert(realAllocSize - tempMemBlockPos == RarMemBlock.size): realAllocSize
            //+   + tempMemBlockPos +   + RarMemBlock.size;

            // Init freeList
            for (int i = 0, pos = freeListPos; i < freeList.Length; i++, pos += RarNode.size)
            {
                freeList[i]         = new RarNode(heap);
                freeList[i].Address = pos;
            }

            // Init temp fields
            tempRarNode      = new RarNode(heap);
            tempRarMemBlock1 = new RarMemBlock(heap);
            tempRarMemBlock2 = new RarMemBlock(heap);
            tempRarMemBlock3 = new RarMemBlock(heap);

            return(true);
        }
Exemplo n.º 5
0
 internal void SetNext(RarNode next)
 {
     SetNext(next.Address);
 }