• 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

JVM memory allocation

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
reply
    Bookmark Topic Watch Topic
  • New Topic