private void showWhoAllocatedMenuItem_Click(object sender, System.EventArgs e) { Histogram selectedHistogram; string title; TypeDesc selectedType = FindSelectedType(); double minAge = 0; double maxAge = double.PositiveInfinity; double age = 0; foreach (Bucket b in bucketTable) { if (b.selected) { minAge = age; maxAge = age + timeScale; } age += timeScale; } title = "Allocation Graph for objects"; if (selectedType != null) { title = string.Format("Allocation Graph for {0} objects", selectedType.typeName); } if (minAge > 0.0) { title += string.Format(" of age between {0} and {1} seconds", FormatTime(minAge), FormatTime(maxAge)); } selectedHistogram = new Histogram(liveObjectTable.readNewLog); LiveObjectTable.LiveObject o; double nowTime = liveObjectTable.readNewLog.TickIndexToTime(liveObjectTable.lastTickIndex); for (liveObjectTable.GetNextObject(0, int.MaxValue, out o); o.id < int.MaxValue; liveObjectTable.GetNextObject(o.id + o.size, int.MaxValue, out o)) { age = nowTime - liveObjectTable.readNewLog.TickIndexToTime(o.allocTickIndex); if (minAge <= age && age < maxAge) { TypeDesc t = (TypeDesc)typeIndexToTypeDesc[o.typeIndex]; if (selectedType == null || t == selectedType) { selectedHistogram.AddObject(o.typeSizeStacktraceIndex, 1); } } } Graph graph = selectedHistogram.BuildAllocationGraph(); GraphViewForm graphViewForm = new GraphViewForm(graph, title); graphViewForm.Visible = true; }