playframework change heap size - java

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.

Related

Intellij JBoss - Initial heap size set to a larger value than the maximum heap size

I am using IntelliJ 2020.1 Ultimate and have a JBoss 7.0.2 server that I want to run from IntelliJ.
I have added it as a configuration:
But when I try start the server, I get the following error:
IDEA.app/Contents/plugins/Kotlin/lib/jps/kotlin-jps-plugin.jar:/Applications/IntelliJ
IDEA.app/Contents/plugins/Kotlin/lib/kotlin-stdlib.jar:/Applications/IntelliJ
IDEA.app/Contents/plugins/Kotlin/lib/kotlin-reflect.jar:/Applications/IntelliJ
IDEA.app/Contents/plugins/Kotlin/lib/kotlin-plugin.jar"
org.jetbrains.jps.cmdline.BuildMain 127.0.0.1 64088
4a7ed3b5-cfb6-4196-b997-396c16d8c06f
/Users/richardmarais/Library/Caches/JetBrains/IntelliJIdea2020.1/compile-server
Picked up JAVA_TOOL_OPTIONS: -Dhttps.protocols=TLSv1.2 -Xmx2048m
-XX:MaxPermSize=1024m -Xms2048m OpenJDK 64-Bit Server VM warning: Ignoring option MaxPermSize; support was removed in 8.0 Error occurred
during initialization of VM Initial heap size set to a larger value
than the maximum heap size
My idea.vmoptions are the default values:
-Xms128m
-Xmx2048m
-XX:ReservedCodeCacheSize=240m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-XX:CICompilerCount=2
-Dsun.io.useCanonPrefixCache=false
-Djdk.http.auth.tunneling.disabledSchemes=""
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-Djdk.attach.allowAttachSelf=true
-Dkotlinx.coroutines.debug=off
-Djdk.module.illegalAccess.silent=true
-XX:+UseCompressedOops
-Dfile.encoding=UTF-8
-XX:ErrorFile=$USER_HOME/java_error_in_idea_%p.log
-XX:HeapDumpPath=$USER_HOME/java_error_in_idea.hprof
Question
Do you know how I can fix the above error to get JBoss to start?
You don't need to set any global environment variables to patch the VM options.
Unset JAVA_TOOL_OPTIONS and specify the proper VM Options in the Run/Debug configuration for the server:
-Xms256m -Xmx2048m -XX:MaxPermSize=512m
It should be more than enough for any project. I doubt that you really need 5GB initial heap size.
Also note that IntelliJ IDEA .vmoptions doesn't affect the options for the apps that you start from the IDE.
I fixed this by doing this.
open -a TextEdit.app ~/.bash_profile
then:
export JAVA_TOOL_OPTIONS="-Dhttps.protocols=TLSv1.2 -Xmx4096m -Xms128m"

Can't solve "Java heap space" error in eclipse

While running my Java code in Eclipse IDE, I got the error:
Exception in thread "D3D Screen Updater" Exception in thread
"AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
I searched for this error and tried solutions described here and here, but they did not work.
I changed these parameters in eclipse.ini:
--launcher.XXMaxPermSize
512M
-Xms40m
-Xmx512m
to:
--launcher.XXMaxPermSize
1024M
-Xms512m
-Xmx2048m
EDIT:
I changed this parameters at Run Configurations:
But I still get the same error. Am I missing something?
The memory settings in eclipse.ini is allocated to Eclipse IDE only,
not the program you want to run. A very common mistake is updated the
heap size in eclipse.ini, and expects it to solve above out of memory
problem.
http://www.mkyong.com/eclipse/eclipse-java-lang-outofmemoryerror-java-heap-space/
Where is the "vmargs" option? If you set the min/max heap, you probably need to do it on the main process, not the launcher.
See the Eclipse FAQ item on setting VM options.
That launcher PermSize opt is a bit ridiculous. Unless you know it is launcher PermSize causing the OOM, keep it at the default of 256m.
[EDIT]
As pointed out else-thread, if this is happening when you run your Java program from Eclipse, you tweak those settings within the "Run Configuration" for that program, not Eclipse.ini.
Also, remember that you can tweak the VM options all you want, but if the program wants to eat all the resources on the box before it OOMs, no amount of tweaking can mitigate this.
If we are using windows try this:
Try setting a Windows System Environment variable called _JAVA_OPTIONS with the heap size you want. Java should be able to find it and act accordingly
Below settings workes for me :
-Xms512m -Xmx1024m -XX:MaxPermSize=512m
Assuming you have 4gb or more RAM, try something like this in eclipse.ini(notice the capital/small letter "m"):
--launcher.XXMaxPermSize
1024M
--launcher.XXMaxPermSize
1024m
-vmargs
-Xms512m
-Xmx2048m

PermGen settings not taking effect

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

Cannot open HPROF file

I'm using Eclipse Indigo and I'm following this tutorial, after I run the example project and get my HPROF file, I tried to open it (see 3.3 Use MAT in the link I gave), I just keep receiving 'Out of Memory' error. I checked the file generated and its size is about 350MB. So I edited the eclipse.ini file to add more memory (I changed -xmx to 1024m), also did the same for the java app in run->run configurations. But no mather what number I give to -xmx I'm still getting the same heap space error. Any ideas? or is there any other tool that I can use?
In my eclipse.ini I use the following settings:
-vmargs
-XX:PermSize=256m
-XX:MaxPermSize=256m
-Xms256m
-Xmx1024m
I am able to open big hprofs with some hundreds of megabytes.

Java.lang.OutOfMemory Java Heap Space JDeveloper

I am writing an application on Java and it is throwing this error Java.lang.OutOfMemory Java Heap Space JDeveloper. I know that I can add java -Xmx512m to the command line to solve the problem. However, I need to run this application on JDeveloper. So, my Question is:
How to increase the size of the Heap on JDveloper?
Thank you,
Sami
Overview
The reasons JDeveloper can run out of memory include heap limits and large files.
Heap Limits
Files that control the amount of memory afforded to the JVM for JDeveloper upon startup, relative to the jdeveloper/ide/bin/ directory, include:
jdev.conf
ide.conf
Update these files as follows:
Quit JDeveloper.
Edit ide.conf.
Append the following
AddVMOption -Xms256M
AddVMOption -Xmx1024M
Edit jdev.conf.
Find the AddVMOption for the "heap size."
Change the values as follows:
AddVMOption -Xmx1024M
AddVMOption -XX:MaxPermSize=1024M
Large Files
JDeveloper naïvely attempts to parse files having known file extensions that are located in the project's root level directory. A sufficiently large file, such as a 3GB XML file, will cause problems. To work around this issue, create a subdirectory for the large data and move the file into it. JDeveloper will not try to find resources in arbitrary subdirectories.
Edit ${JDEV_HOME}\jdev\bin\jdev.conf and set the following options:
AddVMOption -Xmx512M
AddVMOption -XX:MaxPermSize=512M
then restart JDeveloper.
If your jDeveloper doesn't start after trying the above options, reduce the size from 1024 to 768 to 512
In 'ide.conf' change
AddVMOption -Xms256M
AddVMOption -Xmx1024M
to
AddVMOption -Xms256M
AddVMOption -Xmx768M
If this also doesn't start your jDeveloper, change it to
AddVMOption -Xms256M
AddVMOption -Xmx512M
And the same goes with 'jdev.conf'

Categories