> Maybe I'm misunderstanding the documentation, but it seems to > be saying > that if I have a weak reference to an object, the GC doesn't see that > object as any different from an object to which I have no reference, > even though I might want it to leave weak-referenced objects alone > unless memory pressure requires them to be collected.
I don't think that's quite accurate. It would make weak reference pretty useless. The weak references will be reclaimed when the GC is out of memory but will live until then. So it lets the GC drive the bus by allowing it to decide when it can't maintain caches of disposable objects. > It seems like a > rather haphazard approach to caching, to me. System.Web.Caching.Cache > uses quite a bit of P/Invoke interop to find out how much memory is > free, and how much is being used by the cache, and such. I would think > that if weak references were sufficient, they would be used by this > object, but that does not seem to be the case. I'd like to hear more about this - I'm not aware of that at all. Jim You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.