How to give more memory to IntelliJ Idea 9-11 - memory-management

This concerns Intellij from 9 to 11.
In the IDEA window On the bottom right corner I see the current memory usage, typically "224M of 254M" How do I give more memory to Idea so it may read like "224M of 512M" ?
Thank you.

On Mac, $IDEA_HOME/Contents/Info.plist
~: grep --context=5 Xmx /Applications/Maia-IU-94.426.app/Contents/Info.plist
<string>true</string>
<key>apple.awt.fullscreencapturealldisplays</key>
<string>false</string>
</dict>
<key>VMOptions</key>
<string>-Xms128m -Xmx912m -Dfile.encoding=UTF-8 -XX:MaxPermSize=250m -ea -agentlib:yjpagent=disablej2ee,disablecounts,disablealloc,sessionname=IntelliJIdea90 -Xbootclasspath/a:../lib/boot.jar</string>
<key>WorkingDirectory</key>
<string>$APP_PACKAGE/bin</string>
</dict>
</dict>
</plist>
On Windows/Linux, %IDEA_HOME%\bin\idea.vmoptions

Edit the following file:
idea/bin/idea.vmoptions

For Windows, in your IntelliJ Idea folder modify idea.exe.vmoptions.
See http://blogs.jetbrains.com/idea/2006/04/configuring-intellij-idea-vm-options/

If you are using:
Ubuntu
64 bit hardware
then you need to create idea64.vmoptions by simply copying the options from idea.vmoptions file
cat idea.vmoptions > idea64.vmoptions
The parameters remain the same: -Xmx1024M -Xms512M

On the MacOS find the folder where Idea is installed. then open file
Contents/Info.plist
Go all the way to the bottom and find the section that looks like this:
<key>VMOptions</key> <string>-Xms64m -Xmx512m -XX:MaxPermSize=128m -Xbootclasspath/p:

go to that path "C:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.1.4\bin\idea.exe.vmoptions" and change size to -Xmx512m
-Xms128m
-Xmx512m
-XX:MaxPermSize=250m
-XX:ReservedCodeCacheSize=64m
-XX:+UseCodeCacheFlushing
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
hope its will work

On windows 7 (64-bits).
In the folder : C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 13.0\bin
There is a file named : idea64.exe.vmoptions
-Xms128m
-Xmx750m
-XX:MaxPermSize=350m
-XX:ReservedCodeCacheSize=96m
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-XX:+UseCodeCacheFlushing
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
Beware that if the underlying JVM used is 32-bits, the maximum memory is still somewhere below 2048Mb

Related

How to increase available memory size in GroovyConsole?

I'm running scripts inside GroovyConsole 2.4.5 on Windows 7 64-bit and they are crashing due to out of memory error. Runtime.getRuntime().maxMemory() shows 247MB and my PC has 32GB RAM. What is the way to increase memory available for GroovyConsole and underlying JVM?
I tried editing startGroovy.bat file with:
set GROOVY_OPTS="-Xmx2g -Xms1g"
and other values, but it had no effect.
I'm not on Windows, so can't test, but you should be able to use JAVA_OPTS instead of GROOVY_OPTS, ie:
set JAVA_OPTS="-Xmx1G"
Before you run groovyConsole
You're already doing correctly, edit startGroovy.bat and simply try with g lowercase, to set GROOVY_OPTS:
set GROOVY_OPTS="-Xmx1g"
After some tries I see the follow effect, If I use " to set GROOVY_OPTS only work with one parameter, if I want to use two parameters -Xmx1g -Xms512m I've to remove " if not it doesn't works. So you can try with:
set GROOVY_OPTS=-Xmx1g -Xms512m
Instead of
set GROOVY_OPTS="-Xmx1g -Xms512m"
Hope it helps,

How to change language in WebSphere MQ Explorer?

IBM's advice doesn't work for me: http://www-01.ibm.com/support/docview.wss?uid=swg21454454
Open file ...\MQExplorer\eclipse\configuration\config.ini and add this lines:
org.osgi.framework.language=en
osgi.nl=en_US
credits go to: http://blog.ondruska.com/2012/12/switch-eclipse-language.html
With MQ Explorer 9.1.4.0 and following this reply, you need to change the file at:
C:\Program Files\IBM\MQ Explorer\MQExplorer.ini
And add the fourth line:
-vm
jre/jre/bin
-vmargs
-Duser.language=en
-Xmx512M

Cassandra on Windows, uname -o not supported

How do I start Cassandra on Windows?
And what does my environment have to look like?
I am getting an error when starting Cassandra on Windows... uname -o not supported.
I am using uname (GNU sh-utils) 2.0
I am not running in cygwin but just a pure powershell Window.
My Cassandra version comes directly from git
Here is what I tried:
D:\dev\3rdparty\cassandra\cassandra [trunk +1 ~0 -0 !]> .\bin\cassandra.bat -v -f
Detected powershell execution permissions. Running with enhanced startup scripts.
Sourcing cassandra config file: D:/dev/3rdparty/cassandra/cassandra/conf/cassandra-env.ps1
Setting up Cassandra environment
Starting cassandra server
Running cassandra with: [java.exe -javaagent:"D:\dev\3rdparty\cassandra\cassandra\lib\jamm-0.2.6.jar" -ea -Dlog4j.defa
ultInitOverride=true -XX:+CMSClassUnloadingEnabled -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -Xms3072M -Xmx3
072M -Xmn768M -XX:+HeapDumpOnOutOfMemoryError -Xss256k -XX:StringTableSize=1000003 -XX:+UseParNewGC -XX:+UseConcMarkSwe
epGC -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=1 -XX:CMSInitiatingOccupancyFraction=75
-XX:+UseCMSInitiatingOccupancyOnly -XX:+UseTLAB -Djava.net.preferIPv4Stack=true -Dcom.sun.management.jmxremote.port=71
99 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dlog4j.configuration=lo
g4j-server.properties -Dcassandra -Dlogback.configurationFile=logback.xml -Dcassandra.logdir="D:\dev\3rdparty\cassandra
\cassandra/logs" -Dcassandra.storagedir="D:\dev\3rdparty\cassandra\cassandra/data" -cp "D:\dev\3rdparty\cassandra\cassa
ndra\conf";"D:/dev/3rdparty/cassandra/cassandra/lib/airline-0.6.jar";"D:/dev/3rdparty/cassandra/cassandra/lib/antlr-run
time-3.5.2.jar";"D:/dev/3rdparty/cassandra/cassandra/lib/commons-cli-1.1.jar";"D:/dev/3rdparty/cassandra/cassandra/lib/
commons-codec-1.2.jar";"D:/dev/3rdparty/cassandra/cassandra/lib/commons-lang3-3.1.jar";"D:/dev/3rdparty/cassandra/cassa
ndra/lib/commons-math3-3.2.jar";"D:/dev/3rdparty/cassandra/cassandra/lib/compress-lzf-0.8.4.jar";"D:/dev/3rdparty/cassa
ndra/cassandra/lib/concurrentlinkedhashmap-lru-1.4.jar";"D:/dev/3rdparty/cassandra/cassandra/lib/disruptor-3.0.1.jar";"
D:/dev/3rdparty/cassandra/cassandra/lib/guava-16.0.jar";"D:/dev/3rdparty/cassandra/cassandra/lib/high-scale-lib-1.0.6.j
ar";"D:/dev/3rdparty/cassandra/cassandra/lib/jackson-core-asl-1.9.2.jar";"D:/dev/3rdparty/cassandra/cassandra/lib/jacks
on-mapper-asl-1.9.2.jar";"D:/dev/3rdparty/cassandra/cassandra/lib/jamm-0.2.6.jar";"D:/dev/3rdparty/cassandra/cassandra/
lib/javax.inject.jar";"D:/dev/3rdparty/cassandra/cassandra/lib/jbcrypt-0.3m.jar";"D:/dev/3rdparty/cassandra/cassandra/l
ib/jline-1.0.jar";"D:/dev/3rdparty/cassandra/cassandra/lib/jna-4.0.0.jar";"D:/dev/3rdparty/cassandra/cassandra/lib/json
-simple-1.1.jar";"D:/dev/3rdparty/cassandra/cassandra/lib/libthrift-0.9.1.jar";"D:/dev/3rdparty/cassandra/cassandra/lib
/logback-classic-1.1.2.jar";"D:/dev/3rdparty/cassandra/cassandra/lib/logback-core-1.1.2.jar";"D:/dev/3rdparty/cassandra
/cassandra/lib/lz4-1.2.0.jar";"D:/dev/3rdparty/cassandra/cassandra/lib/metrics-core-2.2.0.jar";"D:/dev/3rdparty/cassand
ra/cassandra/lib/netty-all-4.0.20.Final.jar";"D:/dev/3rdparty/cassandra/cassandra/lib/reporter-config-2.1.0.jar";"D:/de
v/3rdparty/cassandra/cassandra/lib/slf4j-api-1.7.2.jar";"D:/dev/3rdparty/cassandra/cassandra/lib/snakeyaml-1.11.jar";"D
:/dev/3rdparty/cassandra/cassandra/lib/snappy-java-1.0.5.1.jar";"D:/dev/3rdparty/cassandra/cassandra/lib/stream-2.5.2.j
ar";"D:/dev/3rdparty/cassandra/cassandra/lib/stringtemplate-4.0.2.jar";"D:/dev/3rdparty/cassandra/cassandra/lib/super-c
sv-2.1.0.jar";"D:/dev/3rdparty/cassandra/cassandra/lib/thrift-server-0.3.5.jar";"D:\dev\3rdparty\cassandra\cassandra\bu
ild\classes\main";"D:\dev\3rdparty\cassandra\cassandra\build\classes\thrift" "org.apache.cassandra.service.CassandraDae
mon"]
"C:/Users/las1/AppData/Local/GitHub/PortableGit_054f2e797ebafd44a30203088cd3d58663c627ef/bin/**uname.exe": invalid option -- o**
Try `"C:/Users/las1/AppData/Local/GitHub/PortableGit_054f2e797ebafd44a30203088cd3d58663c627ef/bin/uname.exe" --help' for
more information.
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
May be you didn't set environment variable properly..
you have to set cassandra_home in environment variables under user variables till below point.
CASSANDRA_HOME : D:\dev\3rdparty\cassandra\cassandra
-> 2nd thing error is suggesting
-Xms3072M -Xmx3072M this are much more
Xms should be around 1 gb or half of your Xmx and Xmx should be 1/2 of RAM size..
so according to your system's ram change this two things into cassandra-env.sh file under cassandra/conf

Sonar - OutOfMemoryError: Java heap space

I am deploying a large Java project on Sonar using "Findbugs" as profile and getting the error below:
Caused by: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError:
Java heap space
What i have tried to resolve this:
Replaced %SONAR_RUNNER_OPTS% with -Xms256m -Xmx1024m to increase the heap size in sonar-runner bat file.
Put "sonar.findbugs.effort" parameter as "Min" in Sonar global parameters.
But both of above methods didn't work for me.
I had the same problem and found a very different solution, perhaps because I'm having a hard time swallowing the previous answers / comments. With 10 million lines of code (that's more code than is in an F16 fighter jet), if you have a 100 characters per line (a crazy size), you could load the whole code base into 1GB of memory. I set it 8GB of memory and it still failed. Why?
Answer: Because the community Sonar C++ scanner seems to have a bug where it picks up ANY file with the letter 'c' in its extension. That includes .doc, .docx, .ipch, etc. Hence, the reason it's running out of memory is because it's trying to read some file that it thinks is 300mb of pure code but really it should be ignored.
Solution: Find the extensions used by all of the files in your project (see more here):
dir /s /b | perl -ne 'print $1 if m/\.([^^.\\\\]+)$/' | sort -u | grep c
Then add these other extensions as exclusions in your sonar.properties file:
sonar.exclusions=**/*.doc,**/*.docx,**/*.ipch
Then set your memory limits back to regular amounts.
%JAVA_EXEC% -Xmx1024m -XX:MaxPermSize=512m -XX:ReservedCodeCacheSize=128m %SONAR_RUNNER_OPTS% ...
this has worked for me:
SONAR_RUNNER_OPTS="-Xmx3062m -XX:MaxPermSize=512m -XX:ReservedCodeCacheSize=128m"
I set it direct in the sonar-runner(.bat) file
I had the same problem when running sonar with maven. In my case it helped to call sonar separately:
mvn clean install && mvn sonar:sonar
instead of
mvn clean install sonar:sonar
http://docs.sonarqube.org/display/SONAR/Analyzing+with+Maven
Remark: Because my solution is connected to maven, this is not the direct answer for the question. But it might help other users who stumple upon it.
What you can do it to create your own quality profile with just some Findbugs rules at first, and then progressively add more and more until you reach his OutOfMemoryError. There's probably only a single rule that makes all this fail because your code violates it - and if you deactivate this rule, it will certainly work.
I know this thread is a bit old but this info might help someone.
For me the problem was not like suggested by the top-answer with the C++ plugin.
Instead my problem was the Xml-Plugin (https://docs.sonarqube.org/display/PLUG/SonarXML)
after I deactivated it the analysis worked again.
You can solve this issue by increase the maximum memory allocated to the appropriate process by increasing the -Xmx memory setting for the corresponding Java process in your sonar.properties file
under SonarQube/conf/sonar.properties
uncomment below lines and increase the memory as you want:
For Web: Xmx5123m -Xms1536m -XX:+HeapDumpOnOutOfMemoryError
For ElasticSearch: Xms512m -Xmx1536m -XX:+HeapDumpOnOutOfMemoryError
For Compute Engine: sonar.ce.javaOpts=-Xmx1536m -Xms128m -XX:+HeapDumpOnOutOfMemoryError
The problem is on FindBugs side. I suppose you're analyzing a large project that probably has many violations. Take a look at two threads in Sonar's mailing list having the same issue. There are some ideas you can try for yourself.
http://sonar.15.n6.nabble.com/java-lang-OutOfMemoryError-Java-heap-space-td4898141.html
http://sonar.15.n6.nabble.com/java-lang-OutOfMemoryError-Java-heap-space-td5001587.html
I know this is old, but I am just posting my answer anyway. I realized I was using the 32bit JDK (version 8) and after uninstalling it and then installing 64bit JDK (version 12) the problem disappeared.

Java error when starting Eclipse on Win 8

When starting Eclipse I get the following error:
Obviously it's trying to use javaw.exe from system32-folder, which it shouldn't I guess. I've set the environment-vars to the following:
JAVA_HOME : "C:\Program Files\Java\jdk1.7.0_07;C:\Program Files (x86)\Java\jdk1.7.0_07"
Path : "... ;C:\Program Files (x86)\Java\jdk1.7.0_07\bin;C:\Program Files\Java\jdk1.7.0_07\bin"
and I added -vm C:\Program Files\Java\jdk1.7...\bin\javaw.exe to eclipse.ini
Java and JDK are installed. x86-version and x64-version.
Has anybody an idea, how I can solve this?
The solution is the following:
I removed the -vm C:\Program ... entry from eclipse.ini
I removed the JAVA_HOME variable
I edited the Path as follows:
I moved the path to javaw.exe to the beginning of the Path-variable, because it's using the first javaw.exe it finds and there's one in system32-folder whyever.

Resources