commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael A. Smith" <...@apache.org>
Subject RE: [collections] SoftRefHashMap (was RE: Avalon excalibur collec tions migration status)
Date Thu, 18 Jul 2002 02:17:53 GMT
On Wed, 17 Jul 2002, Jack, Paul wrote:
> No, Joshua has a point here.  WeakReferences aren't automatically
> cleared the instant the object becomes weakly reachable; the garbage
> collector first has to notice that there aren't any hard references
> to the object.  If the gc is "stop-the-world" and only
> runs when there's demand for memory, then it won't notice weakly
> reachable objects, and won't clear any WeakReferences, until there's
> memory demand.  Essentially they'd be acting like SoftReferences,
> without the bias you mention below.

I think my point still stands that even when the garbage collector in 
this case *does* run, it must clear the weak rerferences before it 
touches any soft references.

> But even in that presumably rare case, the behavior would still be
> different enough to warrant the inclusion of both weak and soft 
> references in ReferenceMap, so I guess the point is moot.

yup.  :)

> Yeah, the more I think about it, there are many different ways people
> might want to keep hard references.  For instance, they might want to
> keep hard references to objects that were created/used within the past
> five minutes, but soft references to older objects.  

yup.  :)

> Point being, I think people could use ReferenceMap as a building block
> for more complicated memory-sensitive caches if they needed to, but 
> building those complications into ReferenceMap doesn't make sense.  So,
> I won't add any freaky MRU stuff.

good.  :)

> I'll probably submit ReferenceMap minus phantoms in about an hour...

cool...  :)

michael


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message