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

Commit f056b99

Browse files
authored
Merge pull request #1803 from mihails-strasuns-sociomantic/stable
[REG] Simple multithreaded program + "-profile=gc" = crash
2 parents 644d6fb + 08835c0 commit f056b99

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)