• 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

Dynamically changing -Xmx

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Is there a way to dynamically increase the max heap size of a VM after the Java process has been started?

In the case of OutOfMemory exception, I'd like to do a heap dump before exit. But doing a heap dump might require additional memory; looking for a way to possibly increase the heap size on the fly.

Thanks
Victor
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Victor,

Its not possible for changing the VM heap or stack memory dynamically. As the Virtual machine will intialize the runtime with the memory limit that you pass on the command line.

Retaining a core dump for out of memory is not possible now; as there will not be enough memory for the virtal machine to retain a core dump in out of memory like situation.

But I can suggest you a crazy idea:
catch the process id of the hung OOME process and pass it on to gcore like tool which will generate a core dump for you to do any post mortem analysis.

May be like this:
gcore 17878 where 17878 is the process id of the hung java process due to oome.

But I have observed a bug which might be fixed in jdk 1.6 which covers your requirement.

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6173515

Regards,
Arjun
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic