Ben, After sending out my message to the list, I had also decided to simply wrap the System.Web.Caching.Cache class, since it provided the functionality I needed. However, I cannot figure out how to get it running outside the context of an Http call. If I call the Cache constructor, it never initializes its instance of InternalCache and all subsequent calls fail.
How did you do this? - John -----Original Message----- From: Ben Kloosterman [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 08, 2002 5:36 PM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] WeakReference and "Aggressive" GC under release mode. GC.Collect() will clean out all weak references and somethings like the Cache class ( in Web) calls it when the machine is low on memory. I wrote a Cache based on the Cache class. This checks the total amount of memory on the machine and the amount the current process is using and trims the cache accordingly. It uses a few WIn32 calls but not too many. Note it is possible if your .NEt process is huge that the cache is set to its minimum value. Let me know if you need more. Ben -----Original Message----- From: Moderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED]]On Behalf Of Sinnott, John Sent: Wednesday, 9 October 2002 5:41 AM To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] WeakReference and "Aggressive" GC under release mode. 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. You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.
