RFR: 8261154: Memory leak in Java_java_lang_ClassLoader_defineClass0 with long class names [v2]
Mandy Chung
mchung at openjdk.java.net
Thu Feb 4 17:49:43 UTC 2021
On Thu, 4 Feb 2021 16:14:57 GMT, Claes Redestad <redestad at openjdk.org> wrote:
>> 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
Looks good. Thanks for fixing this.
-------------
Marked as reviewed by mchung (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/2407
More information about the core-libs-dev
mailing list