Gradle/Java getting "mystery options" out of nowhere - java

I have a project in IntelliJ IDEA with some Gradle tasks. Whenever I run one of the tasks, it will initialize then throw me this error:
Error: A fatal exception has occurred. Program will exit.
Error: A fatal exception has occurred. Program will exit.
Invalid maximum heap size: -Xmx4G
The specified size exceeds the maximum representable size.
The culprit here is that somewhere I am setting an option -Xmx4G but I cannot figure out where. My _JAVA_OPTIONS is set to -Xmx1200M -Xms1200M however it is completely ignoring this. I am using java jdk1.8_211.
I have tried setting a gradle.properties, changing the system-wide gradle.properties, changing _JAVA_OPTIONS and using a different JDK but I can't get it.
Could someone help me find where this option is set?

Related

Unable to increase heap size for jmeter on mac M1

Whenever I am running more than 4000 threads, the jemter test run throws
Uncaught Exception java.lang.OutOfMemoryError: unable to create new native thread in thread Thread[StandardJMeterEngine,5,main]. See log file for details.
Is there a way to increase heap size of JMeter in Mac OSX? I have tried editing the jmeter.bat and jmter.sh file, but it didn't help.
set HEAP=-Xms1g -Xmx4g -XX:MaxMetaspaceSize=1024m
Does any one know how to do it in Mac OSX.
It's neither connected with JMeter or Java, it's your operating system who limits the maximum number of processes which can be created by a single user. I believe you should raise this question in the https://apple.stackexchange.com/ community.
Check out Mac OS X … “fork: Resource temporarily unavailable” article for hints on how to increase the number.
sudo launchctl limit maxproc command should give you the current limit and the possibility to amend it.
More information: 9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure

JVM heap memory

Do we need to mandatory specify JVM heap memory arguments in bat file while calling .jar file?
For example:
start /b "" "jre7\bin\javaw.exe" -Xmx1G -jar XYZ.jar
I have the scenario that in some machine when I explicitly specify the arguments(as above) then Java fatal exception is generated!
enter image description here
Error Message:
"Java virtual machine Launcher:
Error: Could not create Java virtual machine.
Error: A fatal exception has occurred. Program will exit."
But when I remove the arguments then no error is reported.
Please anyone let me know. Thank you.
Xmx is an optional argument that specifies the maximum heap size that can be used by Java. It is not required.
If you specify too large a number, you may get a fatal exception. If you don't specify an option, java chooses the max heap size. You can find the default value of this on linux by running 'java -XX:+PrintFlagsFinal -version | grep MaxHeapSize'
You need to update the windows environment variables _JAVA_OPTIONS and set Xmx1024M there. Once done you can start your JVM just fine.

NetBeans Low on Memory Error

I am new to this kind of error in Netbeans. I have been working in Java J2SE using my net beans 8.0.2. I am doing Fuzzy Search on Strings usually strings having 300-500 length. I am using Levenshtein and Jaro Winkler Algorithms to find the Distance between the strings.
There are about 1500 iterations to find the distance between the strings!
The problem is that my net beans often gives error for:
Low on Memory, Error Unable to Compile
I have done some search online to get rid of this error and found how to increase the heap size by adding
-Xms3G
command means to give 3GB space for the heap! but the error still comes up in the compilation process and project run in net beans.
Can somebody help me out how to get rid of this error because when it happen i got this error
java.lang.noClassDefError
Please help me getting rid of this error I am a newbie for this error!
With -Xms3G, it means that your JVM will be started with Xms amount of memory, the initial memory allocation.
But instead use -Xmx3G which will be able to use a maximum of Xmx amount of memory, the maximum memory allocation.
1.Netbeans Heap Size
If you want to increase the NetbeansIDE heap size, then edit the following file.(the etc folder from your Netbeans installation dir)
C:\Program Files\NetBeans\etc\netbeans.conf
Find the following line and add -J-Xmx3G, you can specify any size. I have provided 3G for eg.
netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-Xmx3G -J-XX:PermSize=32m ......."
2. Project settings for running a project by increasing Heap size from Netbeans
Right Click Project -> Properties -> Run -> VM Options -> Customize Button.
You will find many options for VM, specify value for Xmx.
3. Run a jar file by providing VM options to increase heap size, outside of Netbeans.
Run form command line or write a script.
java -Xmx3G -jar filename.jar
Hope this may help.
The simplest answer for my problem was a trick to identify. I had a number of netbeans projects into my working directory. Suppose that my directory D:\NetBeans\WorkSpace contains about 300 projects!
What I done is that simplify the directory moved the old projects into a new directory and only a few projects left into my netbeans working space.
The error message goes off after moving a number of projects into a new directory.
The thing is when netbeans starts up it loads the projects into the memory and if you have a lot of projects into the loading directory it will cause to leak the memory!
Allocate more memory for NetBeans.
Go to your NetBeans home directory.
Open the netbeans.conf file in the etc directory. //under:Resource/NetBeans/etc
Find the netbeans_default_options parameter in the file.
Set the -J-Xms and -J-XX to larger values. ex:-J-Xms256, -J-XX256
Hope for help.

Not being able to start a java-program with more RAM

I just wanted to start a java program with the following extra parameters:
-Xmx3G -Xms1G
However I get the following message:
Error occurred during initialization of VM Incompatible minimum and
maximum heap sizes specified Picked up _JAVA_OPTIONS: -Xmx512M
I searched for what it could mean and it had to do with the environment variable _JAVA_OPTIONS However I do not have this variable set,
http://i.stack.imgur.com/dRqHT.png
How can I fix this?
Add the variable and restart your pc and delete it again (restart afterwards) and than it worked again.

OutOfMemory in Eclipse in a Launched process

I have an OutOfMemory (heap size) in eclipse using a third party plugin
The plug in is Adobe Livecycle work bench and during the out of memory the
plugin is retrieving via WS (using Axis) a list of around 70 workflow components
on my server
Here is a extract of my call stack in Eclipse
... at org.eclipse.equinox.launcher.Main.main(Main.java:1144)
Caused by: java.lang.OutOfMemoryError: Java heap space; nested
exception is: java.lang.OutOfMemoryError: Java heap space at
org.apache.axis.message.SOAPFaultBuilder.createFault ...
I am using this eclipse.ini
-showlocation
-vm
C:\bea920\jdk150_04\bin\javaw.exe
-vmargs
-Xms512M
-Xmx1024M
I don't use any commandline options
I have added -Xmx1024m to my only Installed JRE in Java/Installed JREs
It seems to me that :
-eclipse is not OutOfMemory itself
it displays only 300Mo out of 1024Mo used
it continues working properly
-the plugin launch its axis parsing without giving it enough memory
Questions :
- Are my suppositions right ?
- How do I find where and how to give more memory to the process launched by eclipse launcher ?
Have you changed your launched VM arguments from the preferences window? Try this:
Window->Preferences
Java->Installed JREs
(select your jre here)->Edit..
Default VM Arguments: -Xmx1024m (or whatever size you like)
Edit 1: Based on your comments, I see that you've already tried this. I assumed that you did not try it based on the portion of your question that reads "How do I find where and how to give more memory to the process launched by eclipse launcher ?". I guess we all know what happens when we assume!
Have you considered upping the memory to something larger just to see if you can get it to run (and possibly get some more info about what is causing it to crash)? Try -Xmx2048m or larger depending on your available memory.
Can you add some information to your question that gives us an idea of what the plugin does? Is this project a web service? etc..
See if you are passing Xms and Xmx options in the command line that you are running eclipse with. The values there will override the values in the eclipse.ini
I think you need to edit your eclipse.ini file which is located in the
same directory as your eclipse exe file. It will contain the -Xms settings
which you can then change.
I recommend running eclipse with the -clean option to purge any caches and re-read your settings.
Also, I've had success moving the eclipse.ini out of the eclipse directory (so there's no eclipse.ini), running eclipse, exiting, moving the ini file back and running again. I didn't bother to try to understand why that helped.
Add -XX:MaxPermSize=256m
This is yet-another-memory-type in Java.
I was able to find were the problem is
I used Fiddler with eclipse (using proxy settings)
This way I was able to spot that the soap answer was an OutOfMemory
soapenv:Fault
faultcode soapenv:Server.generalException
faultstring java.lang.OutOfMemoryError: Java heap space; nested exception is:
java.lang.OutOfMemoryError: Java heap space
So the problem was on the server
I have now another problem : the server builds an answer which is to big for eclipse
Thank you for your answers

Categories

Resources