SomMeri / less4j

Less language is an extension of css and less4j compiles it into regular css. Less adds several dynamic features into css: variables, expressions, nested rules, and so on. Less was designed to be compatible with css and any correct css file is also correct less file.
145 stars 47 forks source link

OutOfMemory when compiling heavy sources #277

Closed alex-bel closed 9 years ago

alex-bel commented 9 years ago

I'm trying to compile ~84 .less files (~700KB total) via Grails less asset plugin and I'm getting OutOfMemory error on 1Gb heap. Quick heap dump analysis shows that source files' content is duplicated for each SourceMapGeneratorV3.Mapping class Screenshot I beleive some kind of caching should be implemented there to avoid content duplication, but I'm not sure where it should be done - in the grails plugin (it uses custom LessSource implementation) or inside less4j

SomMeri commented 9 years ago

Thank you for the pull request, I will merge it into the next release. The primary problem was that it tried to generate source map from the same file multiple times?

SomMeri commented 9 years ago

Is your set of less files secret or belong to an open source project? I am trying to make some changes to grammar (so it ifluences just parsing phase) to see whether it gets faster and could use big less system to test it.

alex-bel commented 9 years ago

The source map is generated for each source file only once, however, source map for one file consists of several mappings (SourceMapGeneratorV3.Mapping instances) and each mapping has own copy of source file's content

My set of source files is Twitter Bootstrap 3.1 and SmartAdmin layout (https://bootstraphunter.com/smartadmin-product.php). The license for SmartAdmin forbids any redistribution or sharing, so I'm afraid I can't share it.

SomMeri commented 9 years ago

It was released as 1.11.0.

davydotcom commented 9 years ago

great find ill get this out in the grails asset-pipeline release ASAP