ACMNexus / google-collections

Automatically exported from code.google.com/p/google-collections
Apache License 2.0
0 stars 0 forks source link

ReferenceMap table contraction. #100

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Are there any plans to implement table contraction (CLR, p. 370) for 
ReferenceMap?

Currently one can synthesize this by passing a contracting "backing map" 
into ReferenceMap on construction, but it sounds like support for this will 
be going away.

Original issue reported on code.google.com by pline...@gmail.com on 21 Oct 2008 at 9:06

GoogleCodeExporter commented 8 years ago
We don't have any plans for table contraction. You're the first person to 
request
that functionality.

As a workaround, you could create a new ReferenceMap with the same reference 
types
and contents as the original, and your code could start using the copied, but
contracted, ReferenceMap.

Original comment by jared.l....@gmail.com on 21 Oct 2008 at 9:31

GoogleCodeExporter commented 8 years ago
Yeah, that's a reasonable workaround.

One issue with the workaround, though, is that you may want your ReferenceMap 
to be 
contracted asynchronously based on removals made by the GC thread.  Since there 
is no 
way to signal the user of GC-based removals, any contraction must wait until 
some 
other thread happens to begin using the map again.

As 'ljnelson' says in Issue #37 it would be great if users could be made aware 
when 
entries are removed by the GC.

Original comment by pline...@gmail.com on 21 Oct 2008 at 9:59

GoogleCodeExporter commented 8 years ago
This issue now applies to MapMaker.  However, there is little demand for table
contraction.  My perspective is that no one cares about it unless they're 
maxing out
their memory, and if they are, our table contraction is likely to be the thing 
that
puts them over the edge to an OOME.  I talked to Bob and he doesn't see this on 
the
horizon for MapMaker either.

However, we do plan to support notification when entries are removed. We still 
have
to decide exactly how, because we don't want to invoke user code in the GC 
thread.

Original comment by kevin...@gmail.com on 17 Mar 2009 at 10:54

GoogleCodeExporter commented 8 years ago
Great, notification will be good enough for my purposes!

Thanks again for a great set of libraries.

Original comment by pline...@gmail.com on 18 Mar 2009 at 8:04