Recommendations for handling KTypeOpenHashSet memory usage?

6 views
Skip to first unread message

je...@streamsets.com

unread,
Nov 3, 2016, 2:19:07 PM11/3/16
to metrics-user
We are using a KTypeOpenHashSet typed to an int (so "IntOpenHashSet").  In our particular application, we have a large number of instances of this object, and we have observed that with heavy/sustained usage, the cumulative memory usage continues to grow, mostly in the form of int[] instances.  These are the keys in the hash set.  Periodically, we clear out the hash set by invoking the clear() method, but this does not actually deallocate any of the memory used by the keys array, it just does an Arrays.fill with the default values.

What is the recommended way to deal with this problem when using a KTypeOpenHashSet?  One option is to null out our reference to this object and recreate a new one, allowing the memory for the old instance (including keys array) to be garbage collected.  But this seems a bit messy.  I read through the Javadocs (and source) and wasn't able to find any methods to actually reduce the size of keys.  Has anyone else encountered this issue, or have recommendations?  Thanks.

je...@streamsets.com

unread,
Nov 3, 2016, 2:24:13 PM11/3/16
to metrics-user
Apologies, it seems I've posted this to the wrong group.
Reply all
Reply to author
Forward
0 new messages