Open the Run Configuration for your application (Run/Run Configurations..., then look for the applications entry in 'Java application').
The arguments tab has a text box Vm arguments, enter
-Xss1m (or a bigger parameter for the maximum stack size). The default value is 512 kByte (SUN JDK 1.5 - don't know if it varies between vendors and versions).
Look at Morris in-order tree traversal which uses constant space and runs in O(n) (up to 3 times longer than your normal recursive traversal - but you save hugely on space). If the nodes are modifiable, than you could save the calculated result of the sub-tree as you backtrack to its root (by writing directly to the Node).
When the argument
-Xss doesn't do the job try deleting the temporary files from:
This did the trick for me.
You need to have a launch configuration inside Eclipse in order to adjust the JVM parameters.
After running your program with either F11 or Ctrl-F11, open the launch configurations in Run -> Run Configurations... and open your program under "Java Applications". Select the Arguments pane, where you will find "VM arguments".
This is where
If you want the launch configuration to be a file in your workspace (so you can right click and run it), select the Common pane, and check the Save as -> Shared File checkbox and browse to the location you want the launch file. I usually have them in a separate folder, as we check them into CVS.
i also have the same problem while parsing schema definition files(XSD) using XSOM library,
i was able to increase Stack memory upto 208Mb then it showed
heap_out_of_memory_error for which i was able to increase only upto 320mb.
the final configuration was
-Xmx320m -Xss208m but then again it ran for some time and failed.
My function prints recursively the entire tree of the schema definition,amazingly the output file crossed 820Mb for a definition file of 4 Mb(Aixm library) which in turn uses 50 Mb of schema definition library(ISO gml).
with that I am convinced I have to avoid Recursion and then start iteration and some other way of representing the output, but I am having little trouble converting all that recursion to iteration.
Add the flag
-Xss1024k in the VM Arguments.
You can also increase stack size in
mb by using
-Xss1m for example .
It may be curable by increasing the stack size - but a better solution would be to work out how to avoid recursing so much. A recursive solution can always be converted to an iterative solution - which will make your code scale to larger inputs much more cleanly. Otherwise you'll really be guessing at how much stack to provide, which may not even be obvious from the input.
Are you absolutely sure it's failing due to the size of the input rather than a bug in the code, by the way? Just how deep is this recursion?
EDIT: Okay, having seen the update, I would personally try to rewrite it to avoid using recursion. Generally having a
Stack<T> of "things still do to" is a good starting point to remove recursion.
- Java stack overflow error - how to increase the stack size in Eclipse?
- how can i minimize the stack trace in eclipse java tomcat?
- How do I increase font size Auto Suggestions and for the log message in Eclipse (Mac OS)?
- How to print to the java stack trace console in an Eclipse plugin?
- How to turn off the Eclipse code formatter for certain sections of Java code?
- How to change font size in Eclipse for Java text editors?
- How do I increase the capacity of the Eclipse output console?
- How to solve could not create the virtual machine error of Java Virtual Machine Launcher?
- How to enable the Java keyword assert in Eclipse program-wise?
- How to fix Eclipse validation error "No grammar constraints detected for the document"?
- How do I stop the error log view showing in eclipse
- How to create the pom.xml for a Java project with Eclipse
- How to filter call stack in Eclipse debug view for Java
- How can I set the current line of execution in the eclipse java debugger?
- How do I display a byte array as an array of hex bytes or unsigned decimal numbers in the Eclipse Java debugger?
- How to know the command line used by Eclipse to run the java program?
- How can I use the java Eclipse Abstract Syntax Tree in a project outside Eclipse? (ie not an eclipse plugin)
- How to change the font size of the Eclipse editor tab's title
- How do I add a shortcut key to Eclipse 3.2 Java plug-in to build the current project?
- Eclipse - how to give the Java Console unlimited length (in # lines)
- How to figure out what error my Java Eclipse project has?
- How to quickly find the main() in java project using eclipse ?
- Have two JDK installed, how to switch the java compiler in Eclipse
- How can I enable the Task List in Eclipse for a Java Project?
- Java How to beautify the java code inside Eclipse IDE
- How do I set the Java Doc for google drive api for android in Eclipse
- Eclipse - how can I determine the number of methods in a Java application
- How do change the font size and font color from a Java file?
- How to install eclipse for java developer,c/c++ developer, php developer at the same time?
- How to set heap size in spark within the Eclipse environment?
More Query from same tag
- How do you search and replace anything beyond an equal sign
- Best way to debug OSGI bundles in Karaf
- How to tell gdb/eclipse not to stop on signal xyz
- How to package a jar file along with reference files?
- Cannot build Grails app in Eclipse with Java 1.8
- How to customize the "Save Resource" dialog of an ISaveablePart in Eclipse?
- Eclipse export tool vs command line jar tool
- Is it possible to have multiple people work on the same Eclipse project at once? (Like Google Docs)
- Confusing java generics error with Map and Collector
- Eclipse 2022-03, -06 with Pydev ignores breakpoints in threads
- Eclipse: Copy/Paste not overwriting existing folders
- Eclipse can't open class declarations
- Android Emulator is running properly but cannot see application on it
- how to delete jetty jars from maven repository
- Multiple Gradle Projects within one Eclipse Project - Refresh Dependencies
- Maven does not automatically download dependencies
- LibGdx getUserData() method -> PC CPU 100%
- Changing the property of an imported class in eclipse
- Calculator_Switch JavaFundamental
- Eclipse Plugin Development: Context menu on extension point org.eclipse.ui.bindings does not contain New -> Key
- Eclipse editing my include paths on exit and/or launch(CDT)
- UnsupportedClassVersionError when running Ant from eclipse
- Fail after copy-paste an existing project into eclipse
- Directory outside of project base directory. Maven-war-plugin - <webResources>
- Error:Android_HOME is set to non-existant path:
- ScrolledComposite splits the screen vertically and content is displayed in the right half
- Android Studio:After logging with Facebook the app comes back to logging page and so the app is not loading the next activity
- Using a variable in strings.xml in Eclipse/Android
- My App Giving FATAL ERROR and Forcely Close
- Eclipse Java Debugger Source Lookup Path