Recently I have been working on adding more accurate Memory Diagnostics to BenchmarkDotNet (not based on ETW, which notifies about allocation when more than 100KB was allocated). For the classic .NET I have used AppDomain.MonitoringTotalAllocatedMemorySize
and for .NET Core (netcoreapp1.1) the GC.GetAllocatedBytesForCurrentThread()
method which was recently introduced.
The problem is that Mono does not implement these methods. It throws NotImplementedException.
Is there any way to obtain the number of allocated bytes for Mono?
mono_gc_alloc_*
functions, but there doesn't appear to be any facility yet within Mono itself, let alone one it could expose.