tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Tomcat Wiki] Trivial Update of "OutOfMemory" by KonstantinKolinko
Date Wed, 05 Feb 2014 13:36:51 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Tomcat Wiki" for change notification.

The "OutOfMemory" page has been changed by KonstantinKolinko:
https://wiki.apache.org/tomcat/OutOfMemory?action=diff&rev1=11&rev2=12

Comment:
Add TOC, remove dead link

  #format wiki
  #language en
+ 
+ <<TableOfContents>>
  
  = How to Deal With Out Of Memory Errors =
  
@@ -18, +20 @@

  An Out Of Memory can be thrown by several causes:
  
   * A servlet trying to load a several GBytes file into memory will surely kill the server.
These kind of errors must be considered a simple bug in our program.
-  * To compensate for the data your servlet tries to load, you increase the heap size so
that there is no room to create the stack size for the threads that need to be created.  The
memory required by each thread will vary by OS but can be as high as 2M by default and in
some OS's (like Debian Sarge) is not reducible with the -Xss parameter. [[http://goobsoft.homeip.net/Wiki.jsp?page=JavaDebianTuning|1]]
 Rule of Thumb, use no more than 1G for heap space in a 32-bit web application.
+  * To compensate for the data your servlet tries to load, you increase the heap size so
that there is no room to create the stack size for the threads that need to be created.  The
memory required by each thread will vary by OS but can be as high as 2M by default and in
some OS's (like Debian Sarge) is not reducible with the -Xss parameter. Rule of Thumb, use
no more than 1G for heap space in a 32-bit web application.
   * Deep recursive algorithms can also lead to Out Of Memory problems. In this case, the
only fixes are increasing the thread stack size ({{{-Xss}}}), or refactoring the algorithms
to reduce the depth, or the local data size per call.
   * A webapp that uses lots of libraries with many dependencies, or a server maintaining
lots of webapps could exhauste the JVM PermGen space. This space is where the VM stores the
classes and methods data. In those cases, the fix is to increase this size. The Sun VM has
the flag {{{-XX:MaxPermSize}}} that allows to set its size (the default value is 64M)
   * Hard references to classes can prevent the garbage collector from reclaiming the memory
allocated for them when a ClassLoader is discarded. This will occur on JSP recompilations,
and webapps reloads. If these operations are common in a webapp having these kinds of problems,
it will be a matter of time, until the PermGen space gets full and an Out Of Memory is thrown.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message