diff --git a/src/rt/profilegc.d b/src/rt/profilegc.d index f750808892..5b197976cc 100644 --- a/src/rt/profilegc.d +++ b/src/rt/profilegc.d @@ -94,8 +94,16 @@ static ~this() // Merge foreach (name, entry; newCounts) { - globalNewCounts[name].count += entry.count; - globalNewCounts[name].size += entry.size; + auto ptr = name in globalNewCounts; + if (ptr) + { + ptr.count += entry.count; + ptr.size += entry.size; + } + else + { + globalNewCounts[name] = entry; + } } } else