[Mono-list] MemoryCache question
Matt Calder
mvcalder at gmail.com
Tue Nov 8 16:58:42 EST 2011
Hi,
My version:
$ mono --version
Mono JIT compiler version 2.11 ((no/7917753 Wed Mar 30 15:47:09 EDT 2011)
Copyright (C) 2002-2011 Novell, Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: yes(2.8svn-mono)
GC: Included Boehm (with typed GC and Parallel Mark)
I am trying to use MemoryCache, but am running into two problems. First, it
does not appear to me that the cacheMemoryLimitMegabytes config parameter
is respected. The application in which the cache is used continually puts
objects into the cache, and its memory footprint continues to grow,
regardless of the value I put in for the memory limit. I implemented a
CachePolicy.RemovedCallback and placed a debugger in it and that callback
is invoked when the timeout for an object expires, but does not get invoked
based on memory usage. Disabling caching altogether removes the problem of
expanding memory usage.
The second issue I am having is that despite the RemovedCallback being
invoked, it does not appear that the object is in fact removed. I realize
that garbage collection puts some uncertainty into this observation, but I
do not see the memory footprint diminish even with very frequent timeouts
on the cache entries.
I perused the source code a bit, and I do not see where the memory usage is
monitored. I do see where the RemovedCallback is invoked, and it seems that
having this called should imply the object was removed from the cache, but
the grosser statistics of memory usage do not support that.
Does the MemoryCache class support the memory limit parameter?
Is there some way the RemovedCallback might be called but the object not
removed from the cache? If not, is it possible the garbage collector is not
collecting? (Yes I realize that is difficult to answer, if it helps, the
cached objects are ~1Mb each.
Thank you for any help on this,
Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20111108/764204b0/attachment.html
More information about the Mono-list
mailing list