-
-
Notifications
You must be signed in to change notification settings - Fork 968
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
MemoryDiagnoser should include memory allocated by all Threads that were live during benchmark execution #723
Comments
This is an issue for me when trying to benchmark Logary, because all GC happens on Hopac threads. However, these threads are known at runtime during setup: https://github.com/Hopac/Hopac/blob/master/Libs/Hopac.Platform/Init.fs#L13 Is there are way to tell BDN about known threads? |
No, but if you run your benchmarks for .NET (not Core) for which we are using different API (which does not have this issue) the allocated memory includes memory allocated by all threads. Unfortunately, there is nothing we can do on our side, we need a new method to be exposed by CoreCLR. |
I've fired up the API discussion in https://github.com/dotnet/corefx/issues/30644 |
It would be nice to get this fixed so that we could get proper memory numbers for async code where some of the callbacks ends up on some other thread. |
This issue has been fixed in #1155 but it's going to work only with .NET Core 3.0 preview6+. The .NET Team does not plan to backport the new API to older versions of .NET Core. |
Should https://github.com/dotnet/performance/blob/master/docs/benchmarkdotnet.md (L233)
be updated to reflect this? |
@gfoidl yes, good catch! Could you please send a PR? |
Yes, will send one. |
Suggested by @stephentoub
Current problem: there is no API available for .NET Core that we could use. As of today BDN is using
System.GC.GetAllocatedBytesForCurrentThread()
for .NET Core. There is no way to iterate through all the threads and get this value. Moreover, some threads could have exited in the meantime.The problem does not occur for .NET framework, where we use
AppDomain.CurrentDomain.MonitoringTotalAllocatedMemorySize
The text was updated successfully, but these errors were encountered: