1

form time to time (which happens very often) i get this exception while i am testing my application on tomcat, i also use mvn jetty:run to deploy my jsf2 web application on tomcat 7

java.lang.OutOfMemoryError: PermGen space

i googled it and found quite a few responses about this exception, and few different opinions too. i am listing some of them here :

1- "This is indeed a very typical error when you want to go Java EE with a simple servletcontainer which isn't designed for that" (this sounds reasonable )

2-use Spring flow to manage your beans life cycle (i am not sure if spring flow does that)

3-be careful about your beans scope (almost all of my beans are request scope or view scope)

4-Your beans should be serializable (although all my beans are srializable i cant see the relevance here)

5- it is normal, because of all the dependencies that tomcat loads, and you should indeed alter your permgen size

so i grabbed a profiler and monitored my application. i pasted the result here. first of all when i restart jetty there is a huge memory peak(second screen shot) then after a while , when i try some image uploading (i use primefaces for that) the out of memory happens (third screen shot). i read here that i should increase the permgen size (which i failed to do it with jetty involved, any help on this will be nice too) but i am not sure if i am allowed to do it in shared tomcat or a shared server.

in conclusion i need to know if there is a problem involved or this is just the way it has to be, and what can i do to decrease memory usage of my application.

first run with jetty up time : 37sec

up time : 15min 20sec

up time : 17min 4sec

Community
  • 1
  • 1
MoienGK
  • 4,544
  • 11
  • 58
  • 92
  • Now it's better. However I can see your permgen is stablished at 75 MB, this should be enough for very small applications and testing purposes, but you should increase it when bringing to production enviroments.. However the short answer to thread's title question is a big NO. That doesn't depend on using JSF or not. – Aritz Oct 30 '13 at 07:51

0 Answers0