FWIW, making this fix not only reduces the memory leak risk, but has a number of nice follow-on benefits that can often trigger further follow-on benefits:

 - fewer fields, so reduced footprint;
 - fewer fields might mean more objects fall under the scalarization threshold, when applicable;
 - less work in constructors;
 - shorter constructors mean more constructors fall under the inlining threshold;
 - more inlining might lead to other optimizations.

So it wouldn't surprise me to see macro-level effects even on programs without memory leaks.

I filed https://bugs.openjdk.java.net/browse/JDK-8271623 <https://bugs.openjdk.java.net/browse/JDK-8271623> to track that enhancement.

Reply via email to