Netbeans 7.0 and scala lead to stackoverflow

I'm having some pretty nasty problems with scala. The problem is that I can compile a small scala project perfectly, but when the projects are larger, the compiler crashes with a StackOverflowException . It is clear that I have to increase the stack size for the compiler, however, perhaps my main problem is here, I do not know how to do this.

I start netbeans with these options:

netbeans_default_options="-J-client -J-Xmx512m -J-Xss8m -J-Xms512m -J-XX:PermSize=128m -J-XX:MaxPermSize=512m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true" 

So, as far as I know, -J-Xss8m should increase the size of the stream stack to 8 mb. However, this does not affect the compiler. So I tried passing the same parameter directly to the compiler using compiler flags that I can set in netbeans, resulting in:

 -deprecation -J-Xss8m 

But then again, this does not help, I still get an exception. I looked through the netbeans documentation, but all I found was the netbeans startup options that I already set. I hope someone here can give me more information on how to deal with this problem.

Additional information: So, in a day I finally got the opportunity to try everything on another machine. I used the same settings and the same compiler, but, to my surprise, I did not get the same result. Meaning, on his machine, the compiler compiles all the code without any exceptions. The only difference between my computer and its one is that it has more processor power and power, but that should not do the deal, since we both use netbeans with the same startup parameters.

To date, I have even tried the RC compiler 2.9 scala, it did not help much. In addition, I checked if I have the correct scala plugin, as problems may occur when using the 2.8 plugin with the 2.9 compiler and vice versa. However, I use the 2.9 plugin and the 2.9 compiler, so great.

+6
source share
1 answer

The problem of giving the Scala compiler more stack space is similar to setting more heaps. Both of these parameters must be specified as user JVM arguments when starting the Scala compiler. However, Netbeans has no documentation on how to do this, so here it is.

The way to specify custom JVM arguments for the Scala compiler with Netbeans is to configure build.xml for each project.

  • Open nbproject / build-impl.xml in the project folder.
  • Search for "scalac" and you will find the following target: -init-macrodef-scalac .
  • Copy the entire target definition, paste it into your build.xml and save it.
  • Close nbproject / build-impl.xml , now you will work with build.xml .
  • For the target you just copied, find the <scalac> tag , the nesting will be as follows: target.macrodef.sequential.scalac
  • Add your own jvmargs tag to the scalac tag, it will look like this: <scalac jvmargs = "- Xss2048k -Xmx2000m" ...>
  • Save build.xml . Now when you compile your project using netbeans, the compiler will start with jvm user arguments.
+3
source

Source: https://habr.com/ru/post/894190/


All Articles