This patch resolves a potential memory leak in
Java_java_lang_ClassLoader_defineClass0
I've not figured a good way to write a regression test, but manually verified
the leak and the fix by adding a microbenchmark that triggers the leak. When
run with `-XX:NativeMemoryTracking=summary -XX:+UnlockDiagnosticVMOptions
-XX:+PrintNMTStatistics` there will be a section of memory of unknown origin,
e.g.:
- Unknown (reserved=65536KB, committed=55104KB)
(mmap: reserved=65536KB, committed=55104KB)
With the patch, there is no memory unaccounted for.
-------------
Commit messages:
- Add code used to generate the X_LONG_NAME_BYTECODE
- Add micros showcasing leak
- Resolve memory leak in defineClass0
Changes: https://git.openjdk.java.net/jdk/pull/2407/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2407&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8261154
Stats: 88 lines in 2 files changed: 84 ins; 0 del; 4 mod
Patch: https://git.openjdk.java.net/jdk/pull/2407.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/2407/head:pull/2407
PR: https://git.openjdk.java.net/jdk/pull/2407