public void AddAllocation(ulong size, ulong count, string typeName) { if (!_allocations.TryGetValue(typeName, out var info)) { info = new AllocationInfo(typeName); _allocations[typeName] = info; } info.AddAllocation(size, count); }
private static void DumpStacks(AllocationInfo allocation, MethodStore methods) { var stacks = allocation.Stacks.OrderByDescending(s => s.Count).Take(10); foreach (var stack in stacks) { Console.WriteLine($"{stack.Count,6} allocations"); Console.WriteLine("----------------------------------"); DumpStack(stack.Stack, methods); Console.WriteLine(); } }
public AllocationInfo AddAllocation(int threadID, ulong size, ulong count, string typeName) { if (!_allocations.TryGetValue(typeName, out var info)) { info = new AllocationInfo(typeName); _allocations[typeName] = info; } info.AddAllocation(size, count); // the last allocation is still here without the corresponding stack if (_perThreadLastAllocation.TryGetValue(threadID, out var lastAlloc)) { Console.WriteLine("no stack for the last allocation"); } // keep track of the allocation for the given thread // --> will be used when the corresponding call stack event will be received _perThreadLastAllocation[threadID] = info; return(info); }