Integrated: JDK-8317987: C2 recompilations cause high memory footprint
Thomas Stuefe
stuefe at openjdk.org
Fri Oct 13 06:47:27 UTC 2023
On Thu, 12 Oct 2023 08:15:12 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
> While playing with the new compiler memory statistic (https://github.com/openjdk/jdk/pull/16076), I saw that +StressRecompile causes a twofold increase in memory used during compilations.
>
> #### Baseline:
>
> highest peak during compilation is ~60 MB, caused by compilation of `java/lang/invoke/LambdaForm$Kind::<clinit>` with ~18k nodes.
>
> `./images/jdk/bin/java -XX:CompileCommand='collectmemstat,*.*' -XX:-StressRecompilation -Xcomp -Xbatch -cp $REPROS_JAR de.stuefe.repros.Simple`
>
>
> total NA RA #nodes time type #rc thread method
> (3/1425)
> 59063K 13406K 40025K 18345 6,174 c2 2 0x00007fdc2c28e7b0 java/lang/invoke/LambdaForm$Kind::<clinit>(()V)
>
>
> #### +StressRecompile:
>
> highest peak during compilation is ~112 MB, same method, sameish node count.
>
> `./images/jdk/bin/java -XX:CompileCommand='collectmemstat,*.*' -XX:+StressRecompilation -Xcomp -Xbatch -cp $REPROS_JAR de.stuefe.repros.Simple`
>
>
> total NA RA #nodes time type #rc thread method
> (16/1434)
> 112M 13469K 94987K 18791 16,451 c2 2 0x00007f790428e7b0 java/lang/invoke/LambdaForm$Kind::<clinit>(()V)
>
>
> 60M -> 112M. In both cases, a large part of the memory was allocated in resource areas. Its relative size compared to the total spike size increased. We accrue a lot of memory in ResourceArea over recompilations.
>
> The solution is to wrap the `Compile` instantiation into a resource mark. Now we are at 61 MB, which is almost baseline:
>
>
> total NA RA #nodes time type #rc thread method
> (3/1430)
> 61203K 13469K 40791K 18791 17,013 c2 2 0x00007fdf7428e7b0 java/lang/invoke/LambdaForm$Kind::<clinit>(()V)
This pull request has now been integrated.
Changeset: c88b3878
Author: Thomas Stuefe <stuefe at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/c88b387881a6e9206f9804b4ca966334c65c008a
Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod
8317987: C2 recompilations cause high memory footprint
Reviewed-by: adinn, kvn
-------------
PR: https://git.openjdk.org/jdk/pull/16161
More information about the hotspot-compiler-dev
mailing list