Skip to content
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 10 commits into from
Jul 18, 2024
Merged

New leak detector #178

merged 10 commits into from
Jul 18, 2024

Commits on Jul 14, 2024

  1. Rewrite the leak detector to use ReferenceQueue

    This will make counting leaked objects, and maintaining internal data structures of the leak detector, much faster.
    chrisvest committed Jul 14, 2024
    Configuration menu
    Copy the full SHA
    43c6d06 View commit details
    Browse the repository at this point in the history

Commits on Jul 15, 2024

  1. Implement an IdentityHashSet for the PreciseLeakDetector

    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.
    chrisvest committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    0db08c7 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d10d1ee View commit details
    Browse the repository at this point in the history
  3. Fix a stack overflow issue in RefillSlot.toString

    The `toString` was recursive, which is a problem when there are a large number of nodes.
    chrisvest committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    9e9c9ec View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    183e518 View commit details
    Browse the repository at this point in the history
  5. Cleanup

    chrisvest committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    f053205 View commit details
    Browse the repository at this point in the history
  6. Cleanup

    chrisvest committed Jul 15, 2024
    Configuration menu
    Copy the full SHA
    27ad148 View commit details
    Browse the repository at this point in the history

Commits on Jul 18, 2024

  1. Configuration menu
    Copy the full SHA
    449d2e7 View commit details
    Browse the repository at this point in the history
  2. Make it possible to customize the hash function in IdentityHashSet

    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.
    chrisvest committed Jul 18, 2024
    Configuration menu
    Copy the full SHA
    330ffd9 View commit details
    Browse the repository at this point in the history
  3. Use a process-wide counter instead of identity hash code for phantom …

    …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.
    chrisvest committed Jul 18, 2024
    Configuration menu
    Copy the full SHA
    161c60a View commit details
    Browse the repository at this point in the history