RFR: 8261154: Memory leak in Java_java_lang_ClassLoader_defineClass0 with long class names [v2]
Claes Redestad
redestad at openjdk.java.net
Thu Feb 4 16:14:57 UTC 2021
> 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. A crude way to manually verify the leak and the fix is provided by the added microbenchmark that triggers the malloc in ClassLoader.c and the associated leak.
>
> E.g., running this with `/usr/bin/time -v $BUILD_DIR/images/jdk/bin/java -Xmx256m -jar $BUILD_DIR/images/test/micro/benchmarks.jar LookupDef.*WeakClass.loadLong -f 0 -i N | grep "Maximum resident set"` yields:
>
> Baseline:
> N = 20 Maximum resident set size (kbytes): 544860
> N = 50 Maximum resident set size (kbytes): 818532
> N = 100 Maximum resident set size (kbytes): 1388560
> N = 200 Maximum resident set size (kbytes): 2124296
> Patch:
> N = 20 Maximum resident set size (kbytes): 480476
> N = 50 Maximum resident set size (kbytes): 764040
> N = 100 Maximum resident set size (kbytes): 782920
> N = 200 Maximum resident set size (kbytes): 921272
Claes Redestad has updated the pull request incrementally with one additional commit since the last revision:
Dial back cleanups and focus patch on the bug at hand
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/2407/files
- new: https://git.openjdk.java.net/jdk/pull/2407/files/972696ec..f25b5f98
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2407&range=01
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2407&range=00-01
Stats: 10 lines in 1 file changed: 0 ins; 5 del; 5 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
More information about the core-libs-dev
mailing list