On Thu, 4 Feb 2021 16:14:57 GMT, Claes Redestad <redes...@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!

-------------

Marked as reviewed by stuefe (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/2407

Reply via email to