java 设置最大堆栈大小
如何设置最大堆栈大小?
我使用 jEdit 在相当大的文件 (73 kb) 中使用正则表达式进行搜索,但失败并出现 StackOverflowException。
我尝试设置 -Xss40m 但它似乎是初始堆栈大小,一段时间后它失败并出现以下异常,
11:45:31 AM [AWT-EventQueue-0] [error] AWT-EventQueue-0: Exception in thread "AWT-EventQueue-0"
11:45:31 AM [AWT-EventQueue-0] [error] AWT-EventQueue-0: java.lang.OutOfMemoryError: unable to create new native thread
11:45:31 AM [AWT-EventQueue-0] [error] AWT-EventQueue-0: at java.lang.Thread.start0(Native Method)
11:45:31 AM [AWT-EventQueue-0] [error] AWT-EventQueue-0: at java.lang.Thread.start(Unknown Source)
11:45:31 AM [AWT-EventQueue-0] [error] AWT-EventQueue-0: at java.awt.EventQueue.initDispatchThread(Unknown Source)
11:45:31 AM [AWT-EventQueue-0] [error] AWT-EventQueue-0: at java.awt.EventDispatchThread.run(Unknown Source)
如果您解释一下为什么抛出 OutOfMemory 以及如何设置最大堆栈大小,我将不胜感激。
How can I set maximum stack size?
I use jEdit to search with regular expression in rather big file (73 kb) and it fails with StackOverflowException.
I tried to set -Xss40m but it seems to be initial stack size and after some time it fails with following exception
11:45:31 AM [AWT-EventQueue-0] [error] AWT-EventQueue-0: Exception in thread "AWT-EventQueue-0"
11:45:31 AM [AWT-EventQueue-0] [error] AWT-EventQueue-0: java.lang.OutOfMemoryError: unable to create new native thread
11:45:31 AM [AWT-EventQueue-0] [error] AWT-EventQueue-0: at java.lang.Thread.start0(Native Method)
11:45:31 AM [AWT-EventQueue-0] [error] AWT-EventQueue-0: at java.lang.Thread.start(Unknown Source)
11:45:31 AM [AWT-EventQueue-0] [error] AWT-EventQueue-0: at java.awt.EventQueue.initDispatchThread(Unknown Source)
11:45:31 AM [AWT-EventQueue-0] [error] AWT-EventQueue-0: at java.awt.EventDispatchThread.run(Unknown Source)
I would appreciate if you explain me why OutOfMemory is thrown and also how to set max stack size.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许您应该将堆内存大小设置为:
java -Xms 512m -Xmx 1024m
Perhaps you should set the heap memory size as so:
java -Xms 512m -Xmx 1024m