[ https://issues.apache.org/jira/browse/MCHECKSTYLE-457?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17943541#comment-17943541 ]
James Nord edited comment on MCHECKSTYLE-457 at 4/11/25 12:24 PM: ------------------------------------------------------------------ I think it's more sinister in checkstyle than this. !screenshot-1.png|thumbnail! {code:java} @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue", "this-escape"}) public class JavaLanguageParser extends Parser { static { RuntimeMetaData.checkVersion("4.13.2", RuntimeMetaData.VERSION); } protected static final DFA[] _decisionToDFA; protected static final PredictionContextCache _sharedContextCache = new PredictionContextCache(); ... {code} So checkstyle uses a static cache and this is the ~160MB was (Author: jnord_cbs): I think it's more sinister in checkstyle than this. !screenshot-1.png|thumbnail! {code:java} @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue", "this-escape"}) public class JavaLanguageParser extends Parser { static { RuntimeMetaData.checkVersion("4.13.2", RuntimeMetaData.VERSION); } protected static final DFA[] _decisionToDFA; protected static final PredictionContextCache _sharedContextCache = new PredictionContextCache(); ... {code} So checkstyle uses a static cache. > memory leak in checkstyle plugin > -------------------------------- > > Key: MCHECKSTYLE-457 > URL: https://issues.apache.org/jira/browse/MCHECKSTYLE-457 > Project: Maven Checkstyle Plugin > Issue Type: Bug > Components: checkstyle:check > Affects Versions: 3.6.0 > Reporter: James Nord > Priority: Major > Attachments: image-2025-04-11-12-55-18-038.png, screenshot-1.png > > > memory used by checkstyle:check mojo is not released after the mojo completes > its analysis. > In a build on [Jenkins|https://github.com/jenkinsci/jenkins/] an analysis of > a heapdump shows that there is 180+MB retained by the JavaLanguageParser > !image-2025-04-11-12-55-18-038.png|thumbnail! > After the invocation of the mojo it is expected that memory would be > relinquished. > h3. Steps to reproduce > * clone https://github.com/jenkinsci/jenkins/ > * switch to the {{jenkins-2.504}} branch > * edit .mvn/jvm.config so it contains the following (to force running out of > memory and providing a heap dump): > {code:properies} > -Xmx500M > -XX:+HeapDumpOnOutOfMemoryError > -XX:HeapDumpPath=D:\source\github\cloudbees\private-jenkins > {code} > * run {{mvn clean verify -DskipTests}} > h3. Expected results > 500M should be enough to build, or if the build fails due to memory there is > no memory held by mojos (for part of their actions) that have completed. > h3. Actual Results > the build fails producing the war in the maven-war-plugin (in the war > project). > Inspection of the heap shows 180MB in use by > com.puppycrawl.tools.checkstyle.grammar.java.JavaLanguageParser classloaders > -- This message was sent by Atlassian Jira (v8.20.10#820010)