Fix issue 41413 (#41445)
authorPeter Sollich <petersol@microsoft.com>
Tue, 1 Sep 2020 10:23:21 +0000 (12:23 +0200)
committerGitHub <noreply@github.com>
Tue, 1 Sep 2020 10:23:21 +0000 (12:23 +0200)
commitb240be8b6e39f6c4344cbdd86cc9a214ae353252
treebf5c64e8f1460002d8f3becae5106cd4182bf826
parent756addda8cf593faf696602d8a9dfef759423849
Fix issue 41413 (#41445)

Fix the AV issue in GCHeap::ApproxTotalBytesInUse:

- The AV is fixed by stopping the iteration when seg1 becomes null
- don't count segments that have been decommited
- stop iterating when seg1 becomes freeable_soh_segment - this takes care of the case where we have put a segment on the list, but the OS call to decommit hasn't come back.

These fixes will still leave a window where the result will be inaccurate. To reduce the chances of an inaccurate result, we try this 3 times.
src/coreclr/src/gc/gc.cpp