[foreign-preview] RFR: 8276648: Downcall stubs are never freed
Jorn Vernee
jvernee at openjdk.java.net
Tue Feb 22 14:12:34 UTC 2022
Hi,
The current code adds native invokers (downcall stubs) to a CocurrentHashMap cache, and they stay there until the application exits.
This patch replaces that cache with a SoftReferenceCache (brought to the top level from AbstractLinker), which allows at least the values to be evicted when they become unreachable.
Those value, which are NativeEntryPoint instances, are also registered with a cleaner, whose cleanup action will free the stub from the code cache.
Thanks,
Jorn
-------------
Commit messages:
- Use SoftReferenceCache for NativeEntryPoint and free stubs with a cleaner
Changes: https://git.openjdk.java.net/panama-foreign/pull/651/files
Webrev: https://webrevs.openjdk.java.net/?repo=panama-foreign&pr=651&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8276648
Stats: 135 lines in 5 files changed: 88 ins; 35 del; 12 mod
Patch: https://git.openjdk.java.net/panama-foreign/pull/651.diff
Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/651/head:pull/651
PR: https://git.openjdk.java.net/panama-foreign/pull/651
More information about the panama-dev
mailing list