NETCF: Total Bytes in Use After GC – Perf counter
At least one of our customers were a bit confused with the .NET Compact Framework performance counter “Total Bytes in Use After GC” which is described as “The number of bytes of memory, native and managed, in use after the last garbage collection. ”. The description lead him to believe it is the total memory in use by a given managed application. That is not true.
The memory inside a .NET Compact Framework managed application can be broadly classified into
- Managed memory
- Jitted code
- Other native memory allocated by the CLR
- Native memory allocated by other sub-systems like say a COM module or some other native modules which the managed application P/Invokes into.
The first three is managed by .NET Compact Framework by using 5 heaps. The counter mentioned above returns the sum of all bytes allocated in all of the first 3 categories. .NETCF doesn’t keep tab of memory allocated in category #4.