-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
GetAllocatedBytesForCurrentThread unpredictably returns inaccurate values #7638
Comments
FYI - this was checked into 1.1.0: dotnet/coreclr#10277 |
@jorive I am closing this issue. please feel free to reactivate if you are seeing problems. |
I dunno if related, but when I use GetAllocatedBytesForCurrentThread in my xunit project I get non realistic extremely high values, like 26111439440 bytes |
@OrbintSoft I will suggest opening a new issue with detailed information about how the API is being used, runtime version, repro case, etc. |
@OrbintSoft I presume you meant that's a non realistic extremely high values because you don't think you've allocated that much on that thread? that's about 25GB of allocations...pretty easily reached if you allocate a lot (eg, if you are running a test that mostly just allocates). if you haven't allocated 25GB yet it tells you 25GB, clearly there's a problem we need to look at; if that's the case please open a new issue as @jorive suggested. |
@Maoni0 yes there is some bad code I was optimize, but 25 Gb I feel too much, that is more than the available RAM. With
I get no more than 400 MiB. Let me do some more investigation before opening a new issue. |
allocated bytes can certainly be way larger than the available RAM and working set if you allocate something very temporary. GC ETW/lttng events will tell you how much you allocated (total). |
I have been working on adding new metrics to Xunit-Performance-API. One of those metrics is the "Allocated bytes in current thread".
While writing tests to exercise the code I noticed I was not getting the expected values. Below I am adding two cases:
Impact:
Having this bug fixed on 1.1 would be essential for correctness of the collected metrics. Bytes allocated is a valuable metric to collect as it can help correlate GC behavior with changes in other metrics when measuring the performance impact of repository changes.
The text was updated successfully, but these errors were encountered: