You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks, I was curious if GetTotalAllocatedBytes result could be accidentally boxed (JIT may hoist allocations in some cases), but it's clearly not the case here.
That does not appear to be the case here. I printed the read values before the subtraction (where the clamp occurs), and both are positive, but the second read is smaller than the first read.
The issue seems to have gotten worse in RC2, not only the random 0 happen a lot more (even with just a simple benchmark) but also starts "hallucinating" with very high values like from 368 B to 1616 B
Unfortunately all the benchmarks I'm working with are having this issue making the results unusable unless I do multiple runs and then manually merge the values that seem to be correct
EDIT: got another run with the high values (NOTE: this benchmark is different from the one above):
It is accounting bug in the GC, likely introduced by the regions feature. It may be useful to check whether it repros with regions turned off. @timcassell Could you please try to set DOTNET_GCName=clrgc.dll and check whether the problem goes away?
Activity
EgorBo commentedon Aug 17, 2025
@timcassell can you point to the code that is measuring memory allocations in BDN?
timcassell commentedon Aug 17, 2025
https://github.com/dotnet/BenchmarkDotNet/blob/e2d30d37433444b0f43088727a14885d76c56bfc/src/BenchmarkDotNet/Engines/Engine.cs#L270-L273
https://github.com/dotnet/BenchmarkDotNet/blob/e2d30d37433444b0f43088727a14885d76c56bfc/src/BenchmarkDotNet/Engines/GcStats.cs#L151
dotnet-policy-service commentedon Aug 17, 2025
Tagging subscribers to this area: @dotnet/gc
See info in area-owners.md if you want to be subscribed.
EgorBo commentedon Aug 17, 2025
Thanks, I was curious if
GetTotalAllocatedBytesresult could be accidentally boxed (JIT may hoist allocations in some cases), but it's clearly not the case here.kg commentedon Aug 18, 2025
Could this be another symptom of #106712 ? I see code in the GcStats.cs that clamps values to zero if they are negative.
timcassell commentedon Aug 18, 2025
That does not appear to be the case here. I printed the read values before the subtraction (where the clamp occurs), and both are positive, but the second read is smaller than the first read.
AdrianoAE commentedon Oct 15, 2025
The issue seems to have gotten worse in RC2, not only the random 0 happen a lot more (even with just a simple benchmark) but also starts "hallucinating" with very high values like from
368 Bto1616 BUnfortunately all the benchmarks I'm working with are having this issue making the results unusable unless I do multiple runs and then manually merge the values that seem to be correct
EDIT: got another run with the high values (NOTE: this benchmark is different from the one above):
Expected (one run without the bug)
adamsitnik commentedon Oct 20, 2025
@dotnet/gc could you PTAL?
timcassell commentedon Dec 1, 2025
Is anyone looking at this? It's blocking BDN from updating tests to newer tfm (it will cause MemoryDiagnoser tests to fail).
agocke commentedon Jan 5, 2026
@dotnet/dotnet-diag Any ideas?
jkotas commentedon Jan 6, 2026
It is accounting bug in the GC, likely introduced by the regions feature. It may be useful to check whether it repros with regions turned off. @timcassell Could you please try to set
DOTNET_GCName=clrgc.dlland check whether the problem goes away?timcassell commentedon Jan 6, 2026
I was unable to repro with that.
jkotas commentedon Jan 6, 2026
Thanks, it confirms the theory that this is likely a bug in GC regions feature.
Fix non-monotonic GC.GetTotalAllocatedBytes under DATAS (Server GC)
Fix non-monotonic GC.GetTotalAllocatedBytes under DATAS (Server GC)
Fix non-monotonic GC.GetTotalAllocatedBytes under DATAS (Server GC)
Add regression test for GetTotalAllocatedBytes under Server GC + DATAS
Fix non-monotonic GC.GetTotalAllocatedBytes under DATAS (Server GC) (#…