[mono][sgen] Fix GetTotalMemory (#84480)
authorVlad Brezae <brezaevlad@gmail.com>
Wed, 19 Apr 2023 14:56:06 +0000 (17:56 +0300)
committerGitHub <noreply@github.com>
Wed, 19 Apr 2023 14:56:06 +0000 (17:56 +0300)
commite146ddae3d8ebb4e24de14ce3f0763f4102e4d8a
tree2a8154f1d1734c57cdf4098ceb332c46dd92bce9
parent211cdd011f19a51b7092d8365e11e774a8280afb
[mono][sgen] Fix GetTotalMemory (#84480)

The previous code was iterating over all blocks, and their freelist, without checking if the block has been swept in the first place. This would lead to incorrect size computation if the block wasn't swept and undefined behavior when racing with concurrent sweep.
src/mono/mono/sgen/sgen-marksweep.c