-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New leak detector #178
Merged
Merged
New leak detector #178
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This will make counting leaked objects, and maintaining internal data structures of the leak detector, much faster.
The IdentityHashSet is based on open-addressing 2-choice hashing with 8-element buckets. Conceptually, this is like bucketed cuckoo-hashing without the cuckoo-ing. The 8-element buckets, and the addition of an 8-element stash for unresolvable conflicts, allow the table to have high utilisation. The table array is a power-of-two size, so in practice utilisation will be between 45% to 90+%. This means it'll take up less memory than the IdentityHashMap-as-a-Set we had before, in part due to not storing values, and in part to using a higher-utilisation hashing algorithm. Theoretically, the 2-choice hashing scheme have higher access costs, due to computing two hashes and having at least two cache-misses, one from each sub-table, but this doesn't seem to be all that noticeable in the grand scheme of things. The access performance is dramatically better than the 2-level chaining Bagwell trie we used before, by simply scaling to larger sizes. The Bagwell trie, as implemented, didn't scale to more than 1000 elements, and relied entirely on chaining for capacities beyond that.
The `toString` was recursive, which is a problem when there are a large number of nodes.
Would be a good idea to inspect the utilisation rate on resizes. |
This is useful when Lilliput will start requiring object header inflation for storing identity hash codes. Identity hash codes are already somewhat expensive to compute on the first call. Identity hash codes might also not have full 32-bit entropy, which can produce a poor distribution. This method makes it possible to use alternative pre-computed hash codes, such as a process-wide counter.
…references in the precise leak detector The added int field hides in alignment padding on most JVM configurations, so the objects won't actually take up more space from this added field.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.