miércoles, 22 agosto 2007
java.lang.OutOfMemoryError: PermGen space // More memory for Tomcat under windows
« Updated: Displaying a jTable inside another jTable // JTable cellRenderer | Main | Viewing and storing images from an IP Camera »In many cases, web applications give OutOfMemoryError when their threads require high levels of memory. Image manipulation or intensive database use or calculation can lead to this very common problem.
Normally when you get an OutOfMemory error in a desktop application, you can solve this problem by specifying the java commands -Xms*** (initial Java heap size) and -Xmx*** (maximum Java heap size) when running your program.
To solve this issue in tomcat, you must specify these options in the tomcat startup command / script / batch. In windows tomcat is installed as a service. Tomcat provides a configuration tool to set up these and other parameters. you can find it in (Start->Programs->Apache Tomcat->Configure Tomcat) or by running (.\bin\tomcat5w.exe" //EN//Tomcat5).

Under the "Java" tab you can find two options:
- Initial memory pool: This corresponds to -Xms, you can specify the size in Mb.
- Maximum memory pool: This corresponds to -Xmx, you can specify the size in Mb.
Now you can specify a higher maximum memory so that Tomcat doesn't get the OutOfMemoryError. Remember to take in consideration your hardware capabilities.
Technorati Tags: OutOfMemoryError OutOfMemory Apache Tomcat Apache Tomcat PermGen Space PermGen space -Xms -Xmx allocate memory increase windows wrapper service
Posted by at 3:55 PM in Apache Tomcat
[Trackback URL for this entry]
Actually your suggestion is pretty wrong when talking PermGen or ThreadStack sizes. Changing values for the size of heap will have zero effect on the thread stack size or the perm gen (where code is loaded) size.
1.Xms and Xmx specify the size of HEAP.
2. Xss specify the thread stack size and hardware platform dependent and you should not change unsless you really know what are you talking about
3. to change the size of PermGen you need to use another parameter: -XX:MaxPermSize=128m (replace 128m with your value) default I think it is 64m but not sure
Cool site.