JDK-8241556 : Memory leak if -XX:CompileCommand is set
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 9,10,11,12,13,14,15
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2020-03-24
  • Updated: 2022-06-27
  • Resolved: 2020-04-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 13 JDK 15
11.0.8-oracleFixed 13.0.4Fixed 15 b18Fixed
Related Reports
Relates :  
Relates :  
Description
There are two memory leaks on the DirectiveSet::DisableIntrinsicOption char array.

(1) DirectiveSet::clone() overwrites this->DisableIntrinsicOption without freeing the old array.
(2) If DisableIntrinsic is set inside -XX:CompileCommand, then compilecommand_compatibility_init() overwrites set->DisableIntrinsicOption without freeing the old array.

The memory leak only exhibits if any value for -XX:CompileCommand is set on command line. The first leak easily causes 200MB-500MB memory leak per instance in production servers.
Note that this leak happens even if -XX:DisableIntrinsic is not set. Because DirectiveSet::canonicalize_disableintrinsic() allocates one-byte empty string "\0" that still gets leaked.
Comments
Fix request (13u): The original change applies cleanly, tier1 tests pass.
05-06-2020

Fix Request: This fixes a pretty serious memory leak for users of -XX:CompileCommand. The only conflicts are the copyright year comments when applying the patch to 11u.
03-04-2020

URL: https://hg.openjdk.java.net/jdk/jdk/rev/2502db745df8 User: manc Date: 2020-04-03 09:02:46 +0000
03-04-2020