Skip to content

OutOfMemoryError in postProcessCheckstyleReport() for large checkstyle-result.xml files #1039

Description

@vivek-0509

detected at: checkstyle/checkstyle#19043 (comment)

postProcessCheckstyleReport() in diff.groovy reads the entire checkstyle-result.xml into a single Java String (diff.groovy)

def content = checkstyleResultFile.text
content = content.replace(oldPath, newPath)
checkstyleResultFile.text = content

For large projects (e.g., openjdk25 with full google_checks.xml), the XML file exceeds the hard JVM String size limit of 1,073,741,823 characters introduced in JDK 9 (JDK-8190429).

Error:(link)
java.lang.OutOfMemoryError: UTF16 String size is 1074003966, should be less than 1073741823

Fix:
Replace the whole-file read with line-by-line streaming

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions