示例#1
0
 internal HeapSegment(RuntimeBase clr, ISegmentData segment, SubHeap subHeap, bool large, HeapBase heap)
 {
     _clr     = clr;
     _large   = large;
     _segment = segment;
     _heap    = heap;
     _subHeap = subHeap;
 }
示例#2
0
        internal bool GetHeaps(out SubHeap[] heaps)
        {
            heaps = new SubHeap[HeapCount];
            Dictionary <ulong, ulong> allocContexts = GetAllocContexts();

            if (ServerGC)
            {
                ulong[] heapList = GetServerHeapList();
                if (heapList == null)
                {
                    return(false);
                }

                bool succeeded = false;
                for (int i = 0; i < heapList.Length; ++i)
                {
                    IHeapDetails heap = GetSvrHeapDetails(heapList[i]);
                    if (heap == null)
                    {
                        continue;
                    }

                    heaps[i] = new SubHeap(heap, i);
                    heaps[i].AllocPointers = new Dictionary <ulong, ulong>(allocContexts);
                    if (heap.EphemeralAllocContextPtr != 0)
                    {
                        heaps[i].AllocPointers[heap.EphemeralAllocContextPtr] = heap.EphemeralAllocContextLimit;
                    }

                    succeeded = true;
                }

                return(succeeded);
            }
            else
            {
                Debug.Assert(HeapCount == 1);

                IHeapDetails heap = GetWksHeapDetails();
                if (heap == null)
                {
                    return(false);
                }

                heaps[0] = new SubHeap(heap, 0);
                heaps[0].AllocPointers = allocContexts;
                heaps[0].AllocPointers[heap.EphemeralAllocContextPtr] = heap.EphemeralAllocContextLimit;

                return(true);
            }
        }