• Post Reply Bookmark Topic Watch Topic
  • New Topic

performance

 
Raj Joe
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
 
Mani Ram
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.
 
Dirk Schreckmann
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).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!