Freigeben über


Bytes In All Heaps > Private Bytes?

The other day I had a friend of mine approach me about a possible bug he had found in the CLR memory perfomance counters. He pointed me to a performance log where his customer had captured a log that showed that the Bytes in All Heaps exceeded that of Private Bytes. Since he knew that Bytes in All Heaps represented the memory in the managed heap and the managed heap is part of Private Bytes how could this be possible? Well the answer is quite simple, its not, and what he was looking at was not a performance bug either but a side effect of how the GC performance counters operatate. The GC only updates it performance counters after a garbage collection as that is the time at which the values that feed into the counters are the most stable and available to publish to the performance block. It just so happens in this performance log that all GC activity had stopped for a while just before the end of the log (probably at the end of a test run) so the counters where not being updated. The private bytes counter will continue to be updated as it is managed by the OS.

Comments