I understand that the refinement over using weak references would be to
dictate the objects that get collected rather than letting the GC decide.
That way you could institute the most recently used policy.  Assuming that
makes a difference.  It might but in that case if you keep your cache too
small you will be taking a hit rebuilding these objects.  If you let the GC
handle it you cache my grow larger than you'd dare let it if you managed it
yourself.

Jim



> -----Original Message-----
> From: Brad Wilson [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, June 04, 2002 4:15 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [ADVANCED-DOTNET] Size of object
>
>
> Joel Mueller wrote:
>
> > 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.
>
> That is precisely the way the weak references work. They will
> stay in memory
> until a GC. And unless someone explicitly calls for a
> collection, then they
> won't disappear until you need more "breathing room" (which causes the
> automatic collection).
>
> So, am I misunderstanding your problem perhaps?
>
> Brad
>
> --
> Read my web log at http://www.quality.nu/dotnetguy/
>
> 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.

Reply via email to