I need help building a useable in-memory object cache.

My first thought was to use the WeakReference class to refer to all
items, in the cache, allowing for GC to remove these items when LOW ON
MEMORY.

This worked while I compiled in debug mode.

Now that I am testing in release mode, however, I am finding the the GC
is collecting these objects when by all means memory is not low.

In fact, if I place more than _one_ object in the cache, it is
collected.

I know that we should not try to code around when the GC will collect,
but is there someway to implement a cache that allows for GC of data at
a more reasonable point?

 - John

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to