Пример #1
0
        HeapObject GetOrCreateObject(long address, HeapTypeInformation heapshotTypeInfo = null)
        {
            if (!Objects.TryGetValue(address, out var heapObject))
            {
                Objects[address] = heapObject = new HeapObject(address);
            }

            if (heapObject.TypeInfo == null && heapshotTypeInfo != null)
            {
                heapObject.TypeInfo = heapshotTypeInfo.TypeInfo;
                heapshotTypeInfo.Objects.Add(heapObject);
            }

            return(heapObject);
        }
Пример #2
0
        public HeapObject AddObject(TypeInformation typeInfo, long address)
        {
            string typeName = typeInfo.Name;
            long   typeId   = typeInfo.TypeId;

            if (trackedTypeNames.Remove(typeName))
            {
                TrackedTypes.Add(typeName, typeId);
            }

            if (!Types.TryGetValue(typeId, out var heapTypeInfo))
            {
                Types[typeId] = heapTypeInfo = new HeapTypeInformation(typeInfo);
            }

            var heapObject = GetOrCreateObject(address, heapTypeInfo);

            Graph.AddVertex(heapObject);

            return(heapObject);
        }
Пример #3
0
 public bool TryGetHeapshotTypeInfo(long typeId, out HeapTypeInformation heapshotTypeInfo)
 => Types.TryGetValue(typeId, out heapshotTypeInfo);
Пример #4
0
        public bool TryGetHeapshotTypeInfo(string name, out HeapTypeInformation heapshotTypeInfo)
        {
            heapshotTypeInfo = null;

            return(TrackedTypes.TryGetValue(name, out var typeId) && TryGetHeapshotTypeInfo(typeId, out heapshotTypeInfo));
        }