The MemoryCache class in .net is supposed to evict items whenever the amount of memory it uses exceeds some limit.
How does it actually determine how much memory its items are using?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
MemoryCachehas an internalCacheMemoryMonitorthat periodically asks its references how big they are. It utilizes an internal type in mscorlib calledSizedReferencewhich is a reference that also keeps track of how much memory (approximately) its target uses.It also collects various statistics from the GC to help ascertain if memory pressure should cause it to start an eviction process.