maidh91 / guava-libraries

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

Add Interner#size() #367

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Adding a method to Interner that returns the number of elements
in the interner would be useful for unit testing and to allow
JMX or other tools to report on the size of the interner to help
track memory usage.

Original issue reported on code.google.com by blair-ol...@orcaware.com on 9 Jun 2010 at 9:21

Attachments:

GoogleCodeExporter commented 9 years ago
It's been on our minds that a map constructed by MapMaker doesn't have the kind 
of "size" method you'd really want.  Right now, it painstakingly counts every 
element to get an exact result, even if it ends up having to lock the entire 
table to do it (in extreme cases)!  What you'd rather have is a fast 
approximation.  Once you had the ability to do this for a "MapMaker-made map", 
the way to expose the feature to interners might be just to allow a custom 
MapMaker to be provided when creating the interner.  Which would of course 
allow other features as well.

Original comment by kevinb@google.com on 10 Jun 2010 at 4:57

GoogleCodeExporter commented 9 years ago

Original comment by fry@google.com on 28 Jan 2011 at 4:18

GoogleCodeExporter commented 9 years ago

Original comment by kevinb@google.com on 13 Jul 2011 at 6:18

GoogleCodeExporter commented 9 years ago

Original comment by kevinb@google.com on 16 Jul 2011 at 8:37

GoogleCodeExporter commented 9 years ago

Original comment by fry@google.com on 10 Dec 2011 at 3:46

GoogleCodeExporter commented 9 years ago
A Cache-powered Interner could support this, no?

Original comment by wasserman.louis on 25 Apr 2012 at 5:51

GoogleCodeExporter commented 9 years ago
You can't really have an Interner backed by a Cache, per the Interner contract, 
if that Cache might have any eviction policy (besides weakKeys).

Original comment by kevinb@google.com on 27 Apr 2012 at 2:29

GoogleCodeExporter commented 9 years ago

Original comment by kevinb@google.com on 30 May 2012 at 7:41

GoogleCodeExporter commented 9 years ago

Original comment by kevinb@google.com on 30 May 2012 at 7:45

GoogleCodeExporter commented 9 years ago
But this Cache gets created for the Interner, so there's no chance for it 
having an unexpected eviction policy, is it?

Original comment by Maaarti...@gmail.com on 29 Jun 2012 at 9:40

GoogleCodeExporter commented 9 years ago
We were at one time considering letting you back an interner with any Cache, 
and I think Louis's point is that that would solve this issue too, since you 
could call cache.size().  But we're not doing that, so my point is that this 
issue is still a valid request.  I suspect you want CacheStats for your 
interners too.

Original comment by kevinb@google.com on 30 Jun 2012 at 2:09

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:15

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:18

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:10