PermGen settings not taking effect - java

I'm trying to increase the amount of PermGen space my application has to avoid some PermGen errors.
I've tried exporting both JAVA_OPTS and MAVEN_OPTS as
-Xms1024m -Xmx2048m -XX:PermSize=1024m -XX:MaxPermSize=2048m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
But jconsole still shows the "CMS Perm Gen" maximum to be:
Max: 83,968 kbytes
and the application still runs out of PermGen space when it hits this.

have you tried adding those options to your pom - under the surefire plugin configuration as you have to tell surefire about these opts explicitly
<argLine>-Xms1024m -Xmx2048m -XX:PermSize=1024m -XX:MaxPermSize=2048m -XX:+CMSClassUnloadingEnabled</argLine>

According your comments you are starting something like cargo plugin. You need to look at the cargo plugin configuration to pass additional VM args, or directly in the script launching tomcat.
The JAVA_OPTS are applied to the launched app when using maven-exec-plugin with goal java

Related

playframework change heap size

My PlayFramework app always starts with only 256mb ram. Is there a way to increase the default ram?
I start my application with sbt run
Thanks in advance
I got this error java.lang.OutOfMemoryError: Java heap space
You can edit sbt\conf\sbtconfig.txt and set -Xmx1024M for sbt globally.
Problem sovled:
"C:\Program Files\Java\jdk1.8.0_144\bin\java.exe" -Dfile.encoding=UTF8 -Djline.terminal=none -Dsbt.log.noformat=true -Dsbt.global.base=C:\Users\USER\AppData\Local\Temp\sbt-global-pluginstub -Xms512M -Xmx1024M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=2048M -classpath C:\Users\User\.IntelliJIdea2018.3\config\plugins\Scala\launcher\sbt-launch.jar xsbt.boot.Boot "project ji_approvalmachine_processes" run
Its not generic solution. But you can use relative paths or enviroment variables instead of the absolute path.

Java heap space error during deployment - returns “OutOfMemoryError"

I have spring app, with intelliJ (community edition), ant, tomcat 8.5. There is build.xml (ant) file that works for others, but in my case it gives me an error :java.lang.OutOfMemoryError: Java heap space.
I have already tried:
Creating setenv.bat (I'm on windows) set JAVA_OPTS=-server -Xmx1024m.
Then, setting CATALINA_OPTS/JAVA_OPTS/ANT_OPTS system env. variable to -Xms512m -Xmx1024m
Then in Configure tomcat(GUI) -> Java -> Initial memory pool and Maximum memory pool to 512 and 1024.
Then in idea.exe.vmoptions (intelliJ), changed -Xms to 512m and -Xmx to 1024m
But it keeps giving me an error about not enough heap space, while other app (spring mvc as well) works perfectly fine on the same computer with the same intelliJ and the same tomcat configuration (but with maven).
I will download JVisualVM to get better overview what is happening but in the meantime maybe someone could give me a tip what else I could try to fix it?

How to build project with loging current -xmx -xms

in my /.AndroidStudio2.2/studio64.vmoptions stated
-Xms8192m
-Xmx8192m
-XX:MaxPermSize=1024m
-XX:ReservedCodeCacheSize=200m
-XX:+UseCompressedOops
when I run project, just before Error:java.lang.OutOfMemoryError: GC overhead limit exceeded , system monitor shows that all jave related procces use ~4g memory.
Is there method to log which vmoptions are actually used?

Tomcat Permgen not increased even if I put it in Java options

I'm running Tomcat 7 as a windows service in a Windows Server 2008 Machine. I've got a Java.lang.OutOfMemoryError: PermGen space so I'm trying to increase its PermGen memory heap. So I specify this line at the end of JVM options:
-XX:PermSize=512m -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:+HeapDumpOnOutOfMemoryError
As specified in the picture below:
The server is properly launched, however I cannot get the permgen size increased. When I enter Tomcat's management GUI, I can see the memory near the limit (the line at the end, PS Perm Gen):
So the application gets stuck after a while. Why is not Tomcat changing this value?
As of my experience you are allowed to put only one option per line.

Set the permgen size for the Child JVM processes that Maven will spin off

I am building a Maven Java app on a Jenkins build server. I am running into java.lang.OutOfMemoryError: PermGen space many times during the build on Jenkins (but never on my localhost) and hence it fails my build.
I have already tried setting MAVEN_OPTS for Jenkins: I went into Jenkins-->Manage Jenkins-->Configure system-->Global MAVEN_OPTS and it was set to -Xms512m -Xmx1024m -XX:MaxPermSize=512m -XX:PermSize=512m. Despite setting it to this high value, we keep running into the PermGen space issues. I don't want to set the MAVEN_OPTS to a higher value; I do not see how my app can require a gig of space, and I'd rather dig deep into the high-memory-usage problem.
Lately, I've been thinking that perhaps the permgen space issue is NOT coming from Maven itself but rather one of the JVM processes that Maven spins off (ex: plugins). I propose this hypothesis because Maven is still able to execute TestNG tests alright, despite already spitting our the permgen space error lines. One such plugin that is causing the PermGen error is Jetty:
Oct 31, 2012 7:55:37 AM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: handle failed
java.lang.OutOfMemoryError: PermGen space
Hence, I would like to know:
Does the MAVEN_OPTS variable also apply to child JVM processes that a Maven build spins off? If not, then how do I set the JVM options for these child processes such as Jetty?
NOTE: I am using Maven 3.0.4.
Most Maven plugins that spawn Java processes will have their own way of specifying JVM command line arguments. For example, you can configure heap and permgen sizes in processes spawned by the Surefire plugin using the argLine configuration parameter (see http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#argLine).
The Jetty plugin doesn't spawn processes, so heap and permgen are governed by JVM arguments provided to the Maven process.
If you are running out of memory when running from Jenkins but not when running locally, check the MAVEN_OPTS that Jenkins passes to Maven.
You can configure vm options globally (settings) and override it for any build job. E.g. in Maven based jobs, the MAVEN_OPTS field is hidden in one of the "advanced" blocks.
As mentioned previously by another reply that every process has its own way of specifying arguments. In case of maven sub process spawned by Jenkins the setting will be in the job configuration under the maven build. You need to click "Advanced" button and set the option in MAVEN_OPTS field. eg : -XX:MaxPermSize=256m -Xms512m -Xmx1024m

Categories