How does MemoryCache know how much memory it uses?

The class MemoryCachein .netshould supplant elements whenever the amount of used memory exceeds a certain limit.

How does it determine the amount of memory that its elements use?

+5
source share
1 answer

MemoryCachehas an internal CacheMemoryMonitorone that periodically requests its links, how large they are. It uses an internal type in mscorlib called SizedReference, which is a link that also keeps track of how much memory (approximately) its target uses.

GC, , .

+4

All Articles