java set max stack size
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 followi开发者_StackOverflow社区ng 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.
Perhaps you should set the heap memory size as so:
java -Xms 512m -Xmx 1024m
精彩评论