Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

OutOfMemoryError

 
martin klima
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When running my Java application, JVM often causes an OutOfMemoryError with message "Java heap space". This application needs about 100MB of memory, I run it on WinXP platform with 1GB memory installed. How can I prevent this error? Can I somehow extend the heap space used by my application? Thank you in advance.
 
David Ulicny
Ranch Hand
Posts: 724
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use -Xmx and -Xms switches from command line.

java -Xms256M -Xmx512M yourClass

check java -X

-Xmx maximum heap size
-Xms initial heap size
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic