public virtual bool startSubAllocator(int SASize)
        {
            int num = SASize;

            if (this.subAllocatorSize != num)
            {
                this.stopSubAllocator();
                int num2 = ((num / 12) * UNIT_SIZE) + UNIT_SIZE;
                int num3 = (1 + num2) + (4 * N_INDEXES);
                this.tempMemBlockPos = num3;
                num3                 += 12;
                this.heap             = new byte[num3];
                this.heapStart        = 1;
                this.heapEnd          = (this.heapStart + num2) - UNIT_SIZE;
                this.subAllocatorSize = num;
                this.freeListPos      = this.heapStart + num2;
                int index = 0;
                for (int i = this.freeListPos; index < this.freeList.Length; i += 4)
                {
                    this.freeList[index]         = new RarNode(this.heap);
                    this.freeList[index].Address = i;
                    index++;
                }
                this.tempRarNode      = new RarNode(this.heap);
                this.tempRarMemBlock1 = new RarMemBlock(this.heap);
                this.tempRarMemBlock2 = new RarMemBlock(this.heap);
                this.tempRarMemBlock3 = new RarMemBlock(this.heap);
            }
            return(true);
        }
        private void insertNode(int p, int indx)
        {
            RarNode tempRarNode = this.tempRarNode;

            tempRarNode.Address = p;
            tempRarNode.SetNext(this.freeList[indx].GetNext());
            this.freeList[indx].SetNext(tempRarNode);
        }
Beispiel #3
0
        private void insertNode(int p, int indx)
        {
            RarNode temp = tempRarNode;

            temp.Address = p;
            temp.SetNext(freeList[indx].GetNext());
            freeList[indx].SetNext(temp);
        }
        private int removeNode(int indx)
        {
            int     next        = this.freeList[indx].GetNext();
            RarNode tempRarNode = this.tempRarNode;

            tempRarNode.Address = next;
            this.freeList[indx].SetNext(tempRarNode.GetNext());
            return(next);
        }
Beispiel #5
0
        private int removeNode(int indx)
        {
            int     retVal = freeList[indx].GetNext();
            RarNode temp   = tempRarNode;

            temp.Address = retVal;
            freeList[indx].SetNext(temp.GetNext());
            return(retVal);
        }
 public virtual void stopSubAllocator()
 {
     if (this.subAllocatorSize != 0)
     {
         this.subAllocatorSize = 0;
         this.heap             = null;
         this.heapStart        = 1;
         this.tempRarNode      = null;
         this.tempRarMemBlock1 = null;
         this.tempRarMemBlock2 = null;
         this.tempRarMemBlock3 = null;
     }
 }
Beispiel #7
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;
     }
 }
Beispiel #8
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);
        }
Beispiel #9
0
 internal void SetNext(RarNode next)
 {
     SetNext(next.Address);
 }
Beispiel #10
0
 internal void SetNext(RarNode next)
 {
     this.SetNext(next.Address);
 }
Beispiel #11
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;
        }
Beispiel #12
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;
     }
 }
Beispiel #13
0
 public virtual void stopSubAllocator()
 {
     if (this.subAllocatorSize != 0)
     {
         this.subAllocatorSize = 0;
         this.heap = null;
         this.heapStart = 1;
         this.tempRarNode = null;
         this.tempRarMemBlock1 = null;
         this.tempRarMemBlock2 = null;
         this.tempRarMemBlock3 = null;
     }
 }
Beispiel #14
0
 public virtual bool startSubAllocator(int SASize)
 {
     int num = SASize;
     if (this.subAllocatorSize != num)
     {
         this.stopSubAllocator();
         int num2 = ((num / 12) * UNIT_SIZE) + UNIT_SIZE;
         int num3 = (1 + num2) + (4 * N_INDEXES);
         this.tempMemBlockPos = num3;
         num3 += 12;
         this.heap = new byte[num3];
         this.heapStart = 1;
         this.heapEnd = (this.heapStart + num2) - UNIT_SIZE;
         this.subAllocatorSize = num;
         this.freeListPos = this.heapStart + num2;
         int index = 0;
         for (int i = this.freeListPos; index < this.freeList.Length; i += 4)
         {
             this.freeList[index] = new RarNode(this.heap);
             this.freeList[index].Address = i;
             index++;
         }
         this.tempRarNode = new RarNode(this.heap);
         this.tempRarMemBlock1 = new RarMemBlock(this.heap);
         this.tempRarMemBlock2 = new RarMemBlock(this.heap);
         this.tempRarMemBlock3 = new RarMemBlock(this.heap);
     }
     return true;
 }