This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin for Android App Development and have Peter Sommerhoff on-line!
See this thread for details.
Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

increasing java heap size  RSS feed

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting below exception when running my java class
java.lang.OutOfMemoryError: Java heap space

pls tell me how to increase JVM heap size for on windows platform

It would be great helpfull anybody send solution for this
 
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its very weird that your VM is out of space. Can you post some code ? and what does this have to do with SCJP ?
 
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi durga,
Could you please tell me snapshot of how many applications you are running ?
How much RAM you have?

1)Try to exit all remaining programs ...
2)You can checkout the free memory using Runtime Class.
 
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Srinivasan thoyyeti:
Hi durga,
Could you please tell me snapshot of how many applications you are running ?
How much RAM you have?

1)Try to exit all remaining programs ...
2)You can checkout the free memory using Runtime Class.



I thought JVMs usually start up with a set amount of memory reserved, so as long as on JVM start up you have enough memory, opening a million other programs later on would not cause a Java out of memory error. Am I wrong?

Yuriy
 
Java Cowboy
Posts: 16084
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How you can set the heap size is described in the documentation. Use the -Xmx... option to set the maximum amount of memory that the JVM will allocate.

But really, instead of just setting the heap size larger, you should have a look at your code and find out why you are getting an OutOfMemoryError. Does your program really need to allocate so much memory or do you have a bug somewhere in your code?
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!