Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Preface

This page discusses various memory issues. In a nutshell - if your computer has less than 128MB of ram - you will probably have trouble. Anyhow, also read the following threads for other memory related issues:

  • Wiki Markup\[http://marc.theaimsgroup.com/?t=104388973000006&r=1&w=2

    java.lang.OutOfMemoryError

    during

    deploy\]

    Wiki Markup
    \[http://marc.theaimsgroup.com/?t=104378347700007&r=1&w=2 Memory requirements\]

    Wiki Markup
    \[http://marc.theaimsgroup.com/?t=104333066400004&r=1&w=2 Memory Mgmt Tomcat\]

    Wiki Markup
    \[http://marc.theaimsgroup.com/?t=103011379700006&r=1&w=2 Tomcat Out of memory\]

    Wiki Markup
    \[http://marc.theaimsgroup.com/?t=104519961700002&r=1&w=2 Tracking memory usage over time\]
    \\

    deploy 



  • Memory requirements



  • Memory Mgmt Tomcat

  • Tracking memory usage over time




TODO: Links above no longer work -  need to pull them from other mailing list archive if they are correct Wiki MarkupAlso look at \[http://java.quest.com/jprobe/jprobe.shtml JProbe\], or \[http://www.borland.com/optimizeit/ OptimizeIt\], or other profiling tools. Lots of people recommend these tools. This is not an endorsement for them, I just notice other people like them.







JSP Recompilation

If your application uses JSPs which are frequently recompiled at runtime, e.g. headers that change value hourly, please make sure to read the JSP HOW-TO page and RELEASE NOTES documents. You may wish to tune the JSP compiler configuration to prevent memory leaks. Of course, these are documents you should have read by now anyways..

Questions

How do I adjust memory settings?

...

  • You're out of memory. Simple as that - add more to your heap.
  • You're out of memory. You have code which is hanging onto object references and the garbage collector can't do its job. Get a profiler to debug this one.
  • You ran out of file descriptors. If you are on a *nix system, it has been observed that an OutOfMemoryError can be thrown if you run out of file descriptors. This can occur if your threshold is too low. The ulimit program can help you out here. You also may need to account for socket connections too when thinking about these thresholds. Google is your friend for getting more information about this topic.
  • You have too many threads running. Some OS's have a limit to the number of threads which may be executed by a single process. (Which is what the JVM is.) Refer to your OS docs for more information on how to raise this threshold.
  • If you have a lot of servlets or JSP's, you may need to increase your permanent generation. By default, it is 64MB. Doubling it to be -XX:MaxPermSize=256m might be a good start.
  • Your OS limits the amount of memory your process may take. OK, this one is grasping at straws.
  • The JVM has a bug. This has been known to happen with JVM1.2.? and using EJB's with another servlet engine.
  • Not actually a reason - but on your particular platform, look at the java -X options. They may be VERY helpful. Wiki Markup\[http://opensource2.atlassian.com/confluence/spring/pages/viewpage.action?pageId=2669 Your classloaders are not being garbage collected\]. \\






How much memory is Tomcat/webapp/??? using?

...