Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

java.lang.OutOfMemoryError  RSS feed

 
Blikkies Marais
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have a problem that the size of my application is using too much memory and I get a "java.lang.OutOfMemoryError
" error.
What I want to do is have a variable in a config file that sets the memory available to the JVM when my application starts up.
What is the java api that I can use in order to set the merory allocation pool? Please can you give an example of the java syntax?
Thanks
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't set it from Java; you have to set it on the JVM command line. For Sun's Java2 JVMs, the switch is -XmxNNm, where NN is the number of megabytes to use. So
java -Xmx128m MyClass
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!