Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use GC.GetTotalAllocatedBytes when available in MemoryDiagnoser #1153

Closed
stephentoub opened this issue May 16, 2019 · 0 comments · Fixed by #1155
Closed

Use GC.GetTotalAllocatedBytes when available in MemoryDiagnoser #1153

stephentoub opened this issue May 16, 2019 · 0 comments · Fixed by #1155
Assignees
Milestone

Comments

@stephentoub
Copy link
Member

Currently MemoryDiagnoser via GcStats uses GC.GetAllocatedBytesForCurrentThread on .NET Core to get the number of allocated bytes, but that ends up yielding misleading information for async tests or tests that otherwise involve work being performed on multiple threads. .NET Core 3.0 adds GC.GetTotalAllocatedBytes:
https://github.com/dotnet/corefx/blob/5310b5646aa1c8b18b6546dc5980c30c35d5f4e4/src/System.Runtime/ref/System.Runtime.cs#L1276
It'd be great to use that instead when it's detected to be available.

@adamsitnik adamsitnik self-assigned this May 16, 2019
adamsitnik added a commit that referenced this issue May 17, 2019
…for all threads (#1155)

* add tests

* use GC.GetTotalAllocatedBytes if available, fixes #1153, fixes #723

* fix naming
@AndreyAkinshin AndreyAkinshin added this to the v0.11.6 milestone May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants