netbeans 7.0 和 scala 结果出现 stackoverflow

发布于 2024-11-27 11:00:02 字数 1043 浏览 2 评论 0原文

我在使用 scala 时遇到了一些相当烦人的问题。问题是,我可以完美地编译小型 scala 项目,但是当项目更大时,编译器会崩溃并出现 StackOverflowException。 显然,我必须增加编译器的堆栈大小,但是,这可能是我的主要问题,我不知道如何。

我使用这些参数启动 netbeans:

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"

因此,据我所知,-J-Xss8m 应该将线程堆栈大小增加到 8 mb。然而,这似乎并不影响编译器。因此,我尝试使用编译器标志直接将相同的参数传递给编译器,我可以在 netbeans 中设置该标志,结果是:

-deprecation -J-Xss8m

但同样,这没有帮助,我仍然遇到异常。我搜索了netbeans文档,但我找到的只是netbeans启动参数,这些参数是我已经设置的。我希望这里有人可以给我更多关于如何处理这个问题的信息。

更多信息: 所以,一天后我终于有机会在另一台机器上尝试一切。我使用了相同的设置和相同的编译器,但令我惊讶的是,我没有得到相同的结果。这意味着,在他的机器上,编译器会毫无例外地编译整个代码。 我的计算机和他的计算机之间的唯一区别是,他的计算机具有更多的 RAM 和 CPU 能力,但这不应该成为交易,因为我们都使用具有相同启动选项的 netbeans。

到目前为止,我什至尝试了2.9 scala编译器的RC,但没有多大帮助。另外,我检查了是否安装了正确的 scala 插件,因为在 2.9 编译器中使用 2.8 插件时可能会出现问题,反之亦然。不过,我使用的是 2.9 插件和 2.9 编译器,所以没关系。

I'm experiencing some rather annoying problems with scala. The problem is, that I can compile small scala project perfectly, but when the projects are bigger, the compiler crashes with an StackOverflowException.
Clearly, I have to increase the stack size for the compiler, however, that's probably my main problem here, I don't know how.

I'm starting netbeans with these parameters:

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'm aware, -J-Xss8m should increase the thread stack size to 8 mb. However, that doesn't seem to affect the compiler. So I tried to pass the same parameter to the compiler directly, using the compiler flags, which I can set in netbeans, resulting in this:

-deprecation -J-Xss8m

But again, that doesn't help, I'm still getting the exception. I searched through the netbeans documentation, but all I found was the netbeans startup parameters, which I had already set. I hope somebody here can give me further information on how to handle this problem.

Further information:
So, after a day I finally had the chance to try everything out on a different machine. I used the same settings and same compiler, but to my surprise, I didn't get the same result. Meaning, on his machine the compiler compiles the whole code without any exception.
The only difference between mine computer and his is, that his has more RAM and CPU power, but that shouldn't make the deal since we both use netbeans with the same startup options.

By now, I even tried out the RC of the 2.9 scala compiler, it didn't help much. Also, I checked if I have the correct scala plugin installed, since there might be problems when using the 2.8 plugin with the 2.9 compiler and vice versa. However, I'm using the 2.9 plugin and 2.9 compiler, so that's fine.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

羅雙樹 2024-12-04 11:00:02

为 Scala 编译器提供更多堆栈空间的问题类似于指定更多堆空间。运行 Scala 编译器时,必须将这两个选项指定为自定义 JVM 参数。然而 Netbeans 缺乏任何关于如何执行此操作的文档,所以这里是。

使用 Netbeans 为 Scala 编译器指定自定义 JVM 参数的方法是为每个项目自定义 build.xml。

  1. 打开项目文件夹中的nbproject/build-impl.xml
  2. 搜索“scalac”,您将找到以下目标:-init-macrodef-scalac
  3. 复制整个目标定义,将其粘贴到 build.xml 中,然后保存。
  4. 关闭nbproject/build-impl.xml,从现在开始您将使用build.xml
  5. 在刚刚复制的目标中,找到 标记,嵌套如下:target.macrodef.sequential.scalac
  6. 添加自定义“jvmargs”属性对于 scalac 标记,它将如下所示:
  7. 保存build.xml。现在,每当您使用 netbeans 编译项目时,编译器都将使用自定义 jvm 参数运行。

The problem of giving the Scala compiler more stack space is similar to specifying more heap space. Both of these options must be specified as custom JVM arguments when running the Scala compiler. However Netbeans lacks any sort of documentation on how to do it, so here it is.

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

  1. Open nbproject/build-impl.xml in the project's folder.
  2. Search for "scalac" and you will find the following target: -init-macrodef-scalac.
  3. Copy the whole target definition, paste it into your build.xml, and save it.
  4. Close nbproject/build-impl.xml, from now on you will work with build.xml.
  5. In the target you just copied, locate the <scalac> tag, the nesting will be as follows: target.macrodef.sequential.scalac
  6. Add a custom "jvmargs" attribute to the scalac tag, it will look as follows: <scalac jvmargs="-Xss2048k -Xmx2000m" ... >
  7. Save the build.xml. Now whenever you compile your project with netbeans, the compiler will be run with the custom jvm arguments.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文