Skip to content

OutOfMemoryError on formating file with no actual code #413

Description

@Eckaaaaaat

Hi,

seems like I found an indentation bomb. Happend to try to format OdfManifestSaxHandler.java (Rev: 1869391) and always failed with OutOfMemoryError (tried up to 12G of heap space).
Original file is 6 kB. Output of formatter would be approximately 3 GB. Smaller test case which could be handled would be

Input:

class X {
	*//** javadoc *//*
	public void foo(Bar bar) {}

	*//** javadoc *//*
	public void foo(Bar bar) {}

	*//** javadoc *//*
	public void foo(Bar bar) {}

	*//** javadoc *//*
	public void foo(Bar bar) {}
}*/

Output (each # represents 100 space characters):

class X {
	*//** javadoc *//*
                 public void foo(Bar bar) {}

                 *//** javadoc *//*
                                                  public void foo(Bar bar) {}

                                                  *//**
#   * javadoc
#   *//*
##       public void foo(Bar bar) {}

##       *//**
####                 * javadoc
####                 *//*
########                                   	public void foo(Bar bar) {}
########                                   }*/

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