• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

performance

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
reply
    Bookmark Topic Watch Topic
  • New Topic