This simple test program runs for a few seconds but claims to have spent more than 93 weeks doing GC:
import core.memory;
import std.stdio;
void main()
{
writeln(GC.profileStats);
scope (exit) writeln(GC.profileStats);
string s;
foreach (i; 0 .. 1_000_000)
s ~= "garbage";
}
ProfileStats(0, 0 hnsecs, 0 hnsecs, 0 hnsecs, 0 hnsecs)
ProfileStats(3, 93 weeks, 6 days, 11 hours, 29 minutes, 42 secs, 914 ms, 306 μs, and 4 hnsecs, 93 weeks, 6 days, 11 hours, 29 minutes, 42 secs, 914 ms, 260 μs, and 8 hnsecs, 31 weeks, 2 days, 3 hours, 49 minutes, 54 secs, 337 ms, 385 μs, and 4 hnsecs, 31 weeks, 2 days, 3 hours, 49 minutes, 54 secs, 337 ms, 401 μs, and 1 hnsec)
Comment #1 by dlang-bot — 2019-03-06T21:07:27Z
@rainers created dlang/druntime pull request #2507 "fix Issue 19723: wrong time values in GC.profileStats" fixing this issue:
- fix Issue 19723 wrong time values in GC.profileStats
missing start time initialization without PC option profile:1
https://github.com/dlang/druntime/pull/2507
Comment #2 by r.sagitario — 2019-03-06T21:08:45Z
Currently only works when passing --DRT-gcopt=profile:1 on the command line.
Comment #3 by dlang-bot — 2019-03-07T06:43:47Z
dlang/druntime pull request #2507 "fix Issue 19723: wrong time values in GC.profileStats" was merged into stable:
- 1104a04765646b5a197ebefd18c94ecc0b5290ff by Rainer Schuetze:
fix Issue 19723 wrong time values in GC.profileStats
missing start time initialization without PC option profile:1
https://github.com/dlang/druntime/pull/2507