Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

performance

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What will happen if there are hundreds of objects in one single JVM,I system does not find memory space.

All the object are in use,so garbage collection will help.

Can you pls let me know how do handle this scenerio
 
Ranch Hand
Posts: 1140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In such case, a java.lang.OutOfMemoryError will be thrown.
You can't handle it at runtime. The only way to avoid this error being thrown is by allocating enough memory to the JVM.
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depending on their size and the size of the available JVM memory, you are in no way assured that an OutOfMemoryError will occur. I've had programs using thousands of objects that didn't even come close to running out of memory.

Moving this to the Performance forum...
 
Raj Joe
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Dirk Schreckmann:
[QB]Depending on their size and the size of the available JVM memory, you are in no way assured that an OutOfMemoryError will occur. I've had programs using thousands of objects that didn't even come close to running out of memory.

What way can I set the memory for the JVM.(Say I am using some app server or a stand alone application)

 
Mani Ram
Ranch Hand
Posts: 1140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Raj Joe:
What way can I set the memory for the JVM.(Say I am using some app server or a stand alone application)



You can set the memory for JVM using the command line arguments which starting Java.
Example

will set the initial heapsize to 128 MB and the maximum heap size to 256 MB
If you are using some application server, you need to include these parameters in the start script (where the Java process is invoked).
 
Stinging nettles are edible. But I really want to see you try to eat this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic