private static List <MemoryElement> GenerateObjectTypeGroups(ObjectInfo[] memory, MemoryElementDataManager.ObjectTypeFilter filter)
        {
            List <MemoryElement> list          = new List <MemoryElement>();
            MemoryElement        memoryElement = null;

            for (int i = 0; i < memory.Length; i++)
            {
                ObjectInfo objectInfo = memory[i];
                if (MemoryElementDataManager.GetObjectTypeFilter(objectInfo) == filter)
                {
                    if (memoryElement == null || objectInfo.className != memoryElement.name)
                    {
                        memoryElement = new MemoryElement(objectInfo.className);
                        list.Add(memoryElement);
                    }
                    memoryElement.AddChild(new MemoryElement(objectInfo, true));
                }
            }
            list.Sort(new Comparison <MemoryElement>(MemoryElementDataManager.SortByMemorySize));
            foreach (MemoryElement current in list)
            {
                current.children.Sort(new Comparison <MemoryElement>(MemoryElementDataManager.SortByMemorySize));
                if (filter == MemoryElementDataManager.ObjectTypeFilter.Other && !MemoryElementDataManager.HasValidNames(current.children))
                {
                    current.children.Clear();
                }
            }
            return(list);
        }
Exemple #2
0
        private static List <MemoryElement> GenerateObjectTypeGroups(ObjectInfo[] memory, MemoryElementDataManager.ObjectTypeFilter filter)
        {
            List <MemoryElement> memoryElementList = new List <MemoryElement>();
            MemoryElement        memoryElement     = (MemoryElement)null;

            foreach (ObjectInfo objectInfo in memory)
            {
                if (MemoryElementDataManager.GetObjectTypeFilter(objectInfo) == filter)
                {
                    if (memoryElement == null || objectInfo.className != memoryElement.name)
                    {
                        memoryElement = new MemoryElement(objectInfo.className);
                        memoryElementList.Add(memoryElement);
                    }
                    memoryElement.AddChild(new MemoryElement(objectInfo, true));
                }
            }
            memoryElementList.Sort(new Comparison <MemoryElement>(MemoryElementDataManager.SortByMemorySize));
            using (List <MemoryElement> .Enumerator enumerator = memoryElementList.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    MemoryElement current = enumerator.Current;
                    current.children.Sort(new Comparison <MemoryElement>(MemoryElementDataManager.SortByMemorySize));
                    if (filter == MemoryElementDataManager.ObjectTypeFilter.Other && !MemoryElementDataManager.HasValidNames(current.children))
                    {
                        current.children.Clear();
                    }
                }
            }
            return(memoryElementList);
        }