As far as I can tell, Anvil uses the VMA library, which includes the function vmaCalculateStats, which is handy for determining how much memory is currently in use (approximately) for each memory type.
It would be useful to get access to that function (or something similar) through Anvil, for benchmarking and debugging purposes.