java.lang.OutOfMemoryError: Java heap space intellij - intellij-idea

I have tried various workarounds but still facing the same issue.
Below I have been using till now.
-Xmx1024m -Xms1024m -XX:MaxPermSize=1024m -DENV=uat -DENV_INSTANCE=uata
Please help.

Go to Help -> Edit custom VM options
Put/replace -Xmx2g in here to increase max heap size to 2 gigabytes for example.
Close the file and restart IntelliJ.
See also How to increase Heap size of JVM

Related

java option xms doesn't seem to go as expected What could be the problem? [duplicate]

I have a java program running in centos Box.
My -Xmx and -Xms set to 4000 Mb.
The program works fine.
But when i do free -m , the used memory is showing as 506 MB. As per my understanding , XMS memory should be reserved for JVM.Why does free command not showing the java used memory ?
I have also done jstat -gccapacity $(pidof java) and there NGCMN and NGCMX updated and have the same value ?
Any support would be helpful.
I'm running my program as java -Xms41000m -Xmx42000m -jar
Even when -Xmx and -Xms set to the same value, the space reserved for Java Heap is not immediately allocated in RAM.
Operating System typically allocates physical memory lazily, only on the first access to a virtual page. So, while unused part of Java Heap is not touched, it won't really consume memory.
You may use -XX:+AlwaysPreTouch option to forcibly touch all heap pages on JVM start.

I am getting this error message while trying to use Testng in Eclipse?

I am getting the error message such as stack overflow, heap memory error and similar messages after trying to use TestNG. And after installing TestNg the Eclipse feels heavy and became very slow to respond. and throwing this error message.
An error of such kind Stackoverflow and heap memory error occurs because of physical lack of resources such as lower Ram or slower processor. So the only solution to this was to allocate more memory to eclipse IDE. you can allocate more memory to eclipse by finding the eclipse.ini file in your directory where you have installed it. After finding the file, the file should be in notepad. open the file in notepad and edit the memory allocated. there are two things you need to change. Xms and XMX, which is minimum and max memory. I made mine from 256m to 512m for XMS and from 1024m to 2048M. But make sure you allocate only the memory which is spare. otherwise your PC might crash. Hope this helps.

Intellij idea Heap size can not be changed

Someday, I run something huge, and a window pop up said that heap memory out of memory, I set it to 2014M in that window, then click continue. Everything was fine.
But I don't like the number 2014, I want it 2048. So, I changed -Xmx option in idea64.exe.vmoptions (like below) and restarted idea. (According to this doc) However, nothing was changed, heap size was still 2014M.
-Xms512m
-Xmx2048m
-XX:ReservedCodeCacheSize=240m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
Then, I changed all idea64.exe.vmoptions I could find, and restarted, and still failed.
OS: windows 10 64-bit
idea version: 2018.1
How can I change the heap size to 2048M ?
Please help, thanks.
update:
That day, I was debugging with some codes which encrypt some huge objects, and the popup showed just after I use copy value function.
I tried to change the heap size of IntelliJ Idea's JVM as the official document, but not working.
The heap memory statistic is here:
update 2:
The log:
2018-07-23 09:54:04,184 [ 224] INFO - #com.intellij.idea.Main - JVM Args: -Xms512m -Xmx2048m -XX:ReservedCodeCacheSize=240m -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Djb.vmOptionsFile=C:\Users\huayu\.IntelliJIdea2018.1\config\idea64.exe.vmoptions -Didea.jre.check=true -Dide.native.launcher=true -Didea.paths.selector=IntelliJIdea2018.1 -XX:ErrorFile=C:\Users\huayu\java_error_in_idea_%p.log -XX:HeapDumpPath=C:\Users\huayu\java_error_in_idea.hprof
Newer versions of IDEA use a different file for vm options. Older versions used to use C:\Program Files\JetBrains\IntelliJ IDEA {version}\bin\idea64.exe.vmoptions but now these configurations exist in C:\Users{user}.IntelliJIdea{version}\config\idea64.exe.vmoptions.
You can get to this file from IntelliJ. On the Help menu, click Edit Custom VM Options. Then restart IDEA and it should update.
Note: It doesn't look like the value displayed in the bottom right will exactly match what you specify in the config file. Not sure why.
See also: How to increase the memory heap size on IntelliJ IDEA?
After Hours and hours searching.
On windows 10
Control Panel => System => Advanced system settings
System Properties => Advanced
Environment Variebles
_JAVA_OPTIONS -Xmx8192M
You changed the heap size of the project you were running within IntelliJ, not the heap size of IntelliJ itself, when you got to that popup.
You would set that in the run configuration for your project.
The startup options change the heapsize of IntelliJ itself, which is not shown on screen constantly.
I have just realised that the memory indicator which is showing the values are coming from 32bit vmoptions file while I'm running the 64 bit idea. And hence the indicator is not showing the correct values.

Increasing the memory size of an Intellij Plugin

I'm developing an Intellij-Plugin. The Plugin needs to have 2GB of HeapMemory (... yes it really needs to ;) ). I found out how I can increase the Memory of the Intellij IDEA VM bis editing the idea64.exe.vmoptions-file like this:
-Xms128m
-Xmx2048m
-XX:MaxPermSize=350m
-XX:ReservedCodeCacheSize=240m
-XX:+UseCodeCacheFlushing
-XX:+UseCompressedOops
If i enable the memory indicator, i can see that it worked.
But if i run/debug my plugin out of Intellij, the "sandbox"-Intellij has only 1GB of RAM.
It throws the flowing warning:
High memory usage (free 101 of 914 MB) while dumping threads
How can i increase the RAM of the sandbox-Plugin?
Setting VM Options in run configuration doesn't work for me.
I found more proper way to do it from this. Add the following to your build.gradle:
runIde {
jvmArgs '-Xmx2G'
}

Idea IntelliJ 14.1 Out of memory

Has someone experienced this?, what value would you suggest for Xmx?
Extra info: It is running in 32 bit (idea.exe)
That depends on the work that you do with IntelliJ (if you work much with larger files, then you should increase the memory more than if you only work with smaller files or projects). I have set Xmx to 2048 MB.
Ok, I managed to make it run with the following configuration in idea64.exe.vmoptions:
-Xms128m
-Xmx1512m
-XX:MaxPermSize=500m
-XX:ReservedCodeCacheSize=225m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
I switched over 64 bit (idea64.exe), the IDE starts, and seems that it has enough memory to load 4 projects with their web applications each.