Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OutOfMemoryError: Java heap space when compiling unwanted source maps #362

Open
fnicollet opened this issue Mar 15, 2017 · 0 comments
Open

Comments

@fnicollet
Copy link

Hello,

We are running into an error, here is the stack trace:

Caused by: java.lang.OutOfMemoryError: Java heap space
	at java.util.Arrays.copyOf(Arrays.java:2367)
	at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:130)
	at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:114)
	at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:415)
	at java.lang.StringBuilder.append(StringBuilder.java:132)
	at java.lang.StringBuilder.append(StringBuilder.java:179)
	at java.lang.StringBuilder.append(StringBuilder.java:72)
	at com.github.sommeri.sourcemap.SourceMapGeneratorV3.addValuesList(SourceMapGeneratorV3.java:367)
	at com.github.sommeri.sourcemap.SourceMapGeneratorV3.addSourceContentMap(SourceMapGeneratorV3.java:339)
	at com.github.sommeri.sourcemap.SourceMapGeneratorV3.appendTo(SourceMapGeneratorV3.java:314)
	at com.github.sommeri.less4j.core.output.SourceMapBuilder.toSourceMap(SourceMapBuilder.java:135)
	at com.github.sommeri.less4j.utils.CssPrinter.toSourceMap(CssPrinter.java:1052)
	at com.github.sommeri.less4j.core.ThreadUnsafeLessCompiler.createCompilationResult(ThreadUnsafeLessCompiler.java:120)
	at com.github.sommeri.less4j.core.ThreadUnsafeLessCompiler.doCompile(ThreadUnsafeLessCompiler.java:88)
	at com.github.sommeri.less4j.core.ThreadUnsafeLessCompiler.compile(ThreadUnsafeLessCompiler.java:76)
	at com.github.sommeri.less4j.core.ThreadUnsafeLessCompiler.compile(ThreadUnsafeLessCompiler.java:65)
	at com.github.sommeri.less4j.core.DefaultLessCompiler.compile(DefaultLessCompiler.java:44)
	at utils.applications.ThemeCompiler.compileThemeContent(ThemeCompiler.java:186)

We don't really care about source map, we don't actually have any, we are just compiling a lot of tiny less files. I tried disabling the source map altogether:

      LessCompiler.Configuration configuration = new LessCompiler.Configuration();
      configuration.getSourceMapConfiguration().setLinkSourceMap(false);
      LessCompiler.CompilationResult result = lessCompiler.compile(source, configuration);

But when I read the code, the option is read in "handleSourceMapLink":

if (!sourceMapConfiguration.shouldLinkSourceMap() && !sourceMapConfiguration.isInline())

Which is right after the "toSourceMap" line where it crashes:

String sourceMap = builder.toSourceMap();
handleSourceMapLink(cssStyleSheet, css, options, lessSource, sourceMap);

Is it an error in less4j? Should the option be read earlier so that it doesn't concatenate Strings that won't be used later?

Fabien

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant