least recently used would be similar to last used - close enough for me anyway.
Normally weaklinks sound good but my concerns with using weaklinks are 1. I can't control which Datatable will be cleaned up, I would like to give some preferences to which tables get cleaned up. 2. I don't want to rewrite DataTables to contain a Collection of DataRows with weak links. Seems a lot of work to me - especially to retain compatability with the standard DataSet. . I definetly would not want the whole table to be cleaned up. Do you know how System.Web.Caching uses P/Invoke interop ? Ben -----Original Message----- From: Moderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED]]On Behalf Of Joel Mueller Sent: Wednesday, 5 June 2002 1:59 AM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Size of object I'm sorry, but I'm a bit confused by this. Ben just got done saying that he needs a mechanism whereby objects that were accessed least-recently are removed first, then you tell him that the garbage collector behaves more-or-less the opposite of what he needs, but that he should go ahead and use weak references, which gives him the GC behavior you just described. How is that a solution? 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. 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. > -----Original Message----- > From: Moderated discussion of advanced .NET topics. > [mailto:[EMAIL PROTECTED]] On Behalf Of > John St. Clair > Sent: Tuesday, June 04, 2002 7:01 AM > To: [EMAIL PROTECTED] > Subject: Re: [ADVANCED-DOTNET] Size of object > > > > Anyone know if the Garbage Collector is spart enough to act > > on objects that > > were not used for the longest period of time ? > > Actually, the generational design of the garbage collection > ensures that if your objects are still referenced after a > long period of time, they will be the most infrequently > collected. Therefore, the "longest period of time" == least > likely to be garbage collected. I would, however, agree with > Ed (?), and suggest that you re-examine your design to use > weak references. > > 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.