• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JVM memory allocation

 
Blikkies Marais
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I set the JVM memory allocation for a class that has not main method? I have an application, where a class is invoked from a startup servlet. How do I set the memory allocation for this application?
Eg. java -mx 20m myClass
is for a specific class. How do I set it for an application?
 
John Smith
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The min/max heap size is not set for any specific class or even a specific application, -- it's the heap size for JVM itself.
 
Joe Ess
Bartender
Posts: 9256
9
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like I was saying in this thread, the VM memory settings is for the entire VM, not for an individual class.
 
Blikkies Marais
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I do this, what is the syntax?
If I try "java -mx1024m", I get prompted with the "java -help" options. How do I know if the VM memory has been set?
 
Joe Ess
Bartender
Posts: 9256
9
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I said in the previous thread, you need to pass the "java" command the name of a class, otherwise it doesn't do anything. I get the impression you are trying to "set" some property on the "java" command in order to solve your OutOfMemoryException
It doesn't work that way. The "java" command takes arguments only for the current run. Even if you started two VM's with different arguments, the arguments of the one would not effect the other.
And as for syntax, you have it correct in the first message of this thread.
[ October 28, 2003: Message edited by: Joe Ess ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic