Reputation: 2052
I am trying to deploy multiple application in a jetty server. Currently I have 50 applications and I'm following the answer from this jetty server 9.1 multiple embeded ports and application in same server instance.
I'm getting java.lang.OutOfMemoryError: PermGen space
at the 38th deployment. How do I solve this?
Upvotes: 1
Views: 7576
Reputation: 10249
Increase the perm and heap size of your jetty instance
when you run it via commandline:
java -jar -XX:MaxPermSize=512m jety.jar
if this doesn't work, increase the size (e.g. 1024m)
Upvotes: 1
Reputation: 49462
Any memory control options are part of the JVM that you start for your embedded Jetty application. That means, in order for you to increase the PermGen that the JVM uses, you'll need to use the command line option -XX:MaxPermSize
against the JVM when you start your embedded Jetty instance.
Example:
$ java -XX:MaxPermSize=1024m -cp myserver.jar com.company.EmbeddedMe
Since you added the eclipse tag, I'll assume you want to know how to configure your "Run Configuration" for this same thing.
In Run > Run Configurations > Arguments Tab > VM Arguments, put -XX:MaxPermSize=1024m
Upvotes: 11
Reputation: 5310
Deploying generates a bunch of Class
objects which are allocated in the permanent space and never really garbage collected.
To solve this, you might want to increase the size of the permanent space with the JVM option -XX:MaxPermSize=128m
(see here for more JVM options/descriptions).
Note that starting with Java8, perm space has been removed. So as an alternative you could also upgrade your JDK to Java8.
Upvotes: 0