private static void CalculateReferencePaths(Dictionary <object, MemoryTracker.ReferenceData> references, IEnumerable <object> objects, int pathCost) { Queue <object> queue = new Queue <object>(objects); while (queue.Count > 0) { object obj = queue.Dequeue(); if (references[obj].path.NullOrEmpty()) { references[obj].path = string.Format("???.{0}", obj.GetType()); references[obj].pathCost = pathCost; } MemoryTracker.CalculateObjectReferencePath(obj, references, queue); } }