Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 08835c0

Browse files
Simple multithreaded program + "-profile=gc" = crash
Fixes issue 15947 (https://issues.dlang.org/show_bug.cgi?id=15947) Fixes issue 14511 (https://issues.dlang.org/show_bug.cgi?id=14511) Root problem was trying to increment non-existent AA field upon merging profile stats. The code was also simplified to remove unnecessary condition.
1 parent 644d6fb commit 08835c0

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/rt/profilegc.d

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,14 @@ static ~this()
8989
{
9090
synchronized
9191
{
92-
if (globalNewCounts.length)
92+
foreach (name, entry; newCounts)
9393
{
94-
// Merge
95-
foreach (name, entry; newCounts)
96-
{
97-
globalNewCounts[name].count += entry.count;
98-
globalNewCounts[name].size += entry.size;
99-
}
94+
if (!(name in globalNewCounts))
95+
globalNewCounts[name] = Entry.init;
96+
97+
globalNewCounts[name].count += entry.count;
98+
globalNewCounts[name].size += entry.size;
10099
}
101-
else
102-
// Assign
103-
globalNewCounts = newCounts;
104100
}
105101
newCounts = null;
106102
}

0 commit comments

Comments
 (0)