• 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

Why do I get a Java heap space error sometimes?

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello

Sometimes I update my web service JAR by deleting the old one (waiting for the undeploy message to appear on the console) and putting the new one (and seeing the deploy message) and when I call it, it gives a heap size error. I have to restart the PC and from then on, it works perfectly 9999999999 times over when I call it.

Why is this? How can I avoid it?
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't - undeploy/deploy does not completely free up all memory your app used. Restart the server will be necessary sometimes.

Bill
 
John Golap
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

William Brogden wrote:You can't - undeploy/deploy does not completely free up all memory your app used. Restart the server will be necessary sometimes.

Bill


Well is there a way to make a memory size unrealistically huge so this does not happen?
 
Greenhorn
Posts: 12
jQuery Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure if JVM would take unrealistic high numbers for heap size.
Even if you have reasonable high number, your server CPU performance will go down as it consumes a lot of physical memory.
Also it is a matter of time when your JVM catches up with your high number.

As bill recommended , Best practice would be server restarts.
( Server restart as in stop and start your application server and not restarting your PC )
 
reply
    Bookmark Topic Watch Topic
  • New Topic