title: YUICompressor crashes - stackoverflow error
body: <p>I frequently get what appears to be a stackoverflow error ;-) from YUICompressor. The following is the first part of thousands of error lines that come from attempting to compress a 24074 byte css stylesheet (not the "Caused by java.lang.StackOverflowError about 8 lines down):</p>
  
  <pre><code>iMac1:src jas$ min ../style2.min.css style2.css 
  Exception in thread "main" java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21)
  Caused by: java.lang.StackOverflowError
      at java.lang.Character.codePointAt(Character.java:2335)
      at java.util.regex.Pattern$CharProperty.match(Pattern.java:3344)
      at java.util.regex.Pattern$Branch.match(Pattern.java:4114)
  </code></pre>
  
  <p>... (plus 1021 more error lines) </p>
  
  <p>The errors happen usually after adding a couple of lines to the file getting compressed. The css is fine, and works perfectly in the uncompressed format. I don't see a particular pattern to the types of selectors added to the file that cause the errors. In this case, adding the following selector to a previously compressible file resulted in the errors:</p>
  
  <pre><code>#thisisatest
  {
      margin-left:87px;
  }
  </code></pre>
  
  <p>I am wondering if there is perhaps a flag to java to enlarge the stack that might help. Or if that is not the problem, what is?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>As I was posting this question, it dawned on me that I should check the java command to see if there was a parameter to enlarge the stack. Turns out that it is -Xssn, where "n" is a parameter to indicate the stack size. Its default value is 512k. So I tried 1024k but that still led to the stackoverflow. Trying 2048k works however, and I think this could be the solution.</p>
  
  <p><strong>EDIT 2:</strong></p>
  
  <p>While I no longer use this method for minification any longer, to be more specific here is the full command (which I have set up as a shell alias), showing how the -Xss2048k parameter is used:</p>
  
  <p>java -Xss2048k -jar ~/Documents/RepHunter/Website\ Materials/Code/Third\ Party\ Libraries/YUI\ Compressor/yuicompressor-2.4.8.jar --type css -o </p>