Eclipse java application heap size cannot exceed 4G - java

I need to run an application with -Xmx12g but I cannot get 12g in eclipse.
I can run it fine from terminal directly, java -Xmx12g ... which shows me the max memory as 12G from this command:
Runtime.getRuntime().maxMemory();
Running same thing in eclipse, as runtime vm parameters, I get 4G max. I tried maxing values in eclipse.ini(which should not affect my java application right?), no change.
I have 16G ram, my friend has 64G, he can run it fine but I can't get more than 4g with same settings. I'm not getting any error or anything.
64 bit os, 64 bit vm

Eclipse -> Preferences -> Java -> Installed JREs. There is a default VM arguments part for each JRE, which was causing everything to run in 4G for me, even though I try to override -Xmx in Run Configuration

Related

Chef Java malloc issues

I have having a strange issue installing a piece of software that uses a ANT based installation script executed from a JAR using the Oracle JVM (1.8) 64bit.
The issue only appears to happen when the JAR is executed via a Chef run. Note I am using Chef-zero to converge.
The issue appears to be with the JVM being able to allocate enough
memory to execute.
The issue ONLY appears when Chef executes the JAR, via the OS console
itself and CMD everything is fine.
We have been installing this software for years and have not seen
this issue ever prior, until we started using Chef.
There are different errors depending on what I try to set the HEAP values to (note never have we had to set any HEAP options to install previously).
One such error is :
Unable to allocate 65536KB bitmaps for parallel garbage collection for the requested 2097152KB heap.
I have also seen other similar errors depending on the values I provide for Xms and Xmx similar to the above.
This has only been seen on Windows systems and only on certain VirtualBox images.
Some downloaded from net (vagrant) work fine, some fail with above
error.
Any image I build locally fails.
Chef Scripts I have tried (note the java options I have tried many combination, this is latest try):
execute "Install Xstore: #{build_file}" do
command "#{java_home}\\bin\\java -jar #{build_file}"
cwd install_workdir
environment ({ 'PATH' => "c:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\130\\Tools\\Binn\\;#{ENV['PATH']}", 'JAVA_TOOL_OPTIONS' => '-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=c:/xstore/log/dump.bin' })
not_if { ::Dir.exist?(xstore_install_dir) }
end
ruby_block "Install Xstore: #{build_file}" do
block do
stdout, status = Open3.capture2("#{java_home}\\bin\\java -jar #{build_file}", chdir: "#{install_workdir}")
puts stdout
end
end
Some specs:
Chef-client: 14.14.29
Guest VM: Windows 10, Windows 10ltsc - 64bit
Host: PopOS Linux 19.10
VirtualBox version: 6.0.14
Java (guest): 1.8.0_241
Host Ram 32GB, VM Ram upto 16GB same issues (ram is always 90% free on guest taskmanager, paging file set to System, tried fixed as well)

How to set G1GC in Play application

I'm trying to run a play application on Debian, running on Java 8, but I want to change the default garbage collector in the options to -XX:+UseG1GC.
My OS details:
Linux version 3.16.0-4-amd64 (debian-kernel#lists.debian.org) (gcc version 4.8.4 (Debian 4.8.4-1) ) #1 SMP Debian 3.16.43-2+deb8u2 (2017-06-26)
I've tried multiple option combinations and none appear to work.
My command is something like:
bin/playapp -mem 1024
And I have tried to change it to:
bin/playapp -XX:+UseG1GC -mem 1024
And...
bin/playapp -J-XX:+UseG1GC -mem 1024
I've even removed the mem variable to see if would work without it in both of the above scenarios and neither are working.
Anyone know how to set the G1GC garbage collector for a Play app running on Java 8?
UPDATE:
I should add, for context, that it is run via supervisorctl, where the command in the command is:
command=/home/mdmuser/playapp/bin/playapp -mem 1024
I tried using -J-XX:+UseG1GC directly from the command line and it seems to work, but it doesn't work when running via supervisorctl configuation.
The issue was not actually the syntax at all. It was the fact that when I moved to the G1GC garbage collector, I needed to allocate less memory to the JVM in my virtual machine. I reduced the memory from 1Gb to 512Mb and it then worked fine using the following syntax:
command=/home/mdmuser/playapp/bin/playapp -J-XX:+UseG1GC -mem 512
Apologies for any time wasted.

IBM Heap Dump Analyzer | Out of memory

I am running on 7 GM Ram machine , I have a heap dump file of size 1.8 GB . I am using Java 8 of 64 bit and running on 64 bit machine.
When i try to open the phd file from heap dump analyzer tool , it throws out of memory error. I am setting java vm args for heap analyzer tool as below
java -Xmx4g -XX:-UseGCOverheadLimit
but still i am unable to open file. Please let me know how can i overcome this.
This happens due to that the default heap size is smaller than needed by the dump size to be loaded, to resolve this, you need to set the VM args Xms, and XmX with the right values, below is what worked for me:
"<JAVA_PATH>\Java.exe" -Xms256m -Xmx6144m -jar <HEAP_ANALYSER_NAME>.jar
I hope that helps, I know it is a bit late response :)
I faced the same issue multiple times. I noticed that the analyzer runs better on Linux. On windows it needs a very large amount of memory most of the times - and surprisingly I did not see any apparent direct co-relation between the heapdump size and the required xmx size by the analyzer.
You can either try on Linux if that is an option, or increase the xmx size further.
I Installed JDK 1.8 along with JRE 1.8 and made the changes Java Runtime Environment Settings : java control panel --> Java --> View --> User (Run Time Parameters to -Xms256m -Xmx6144m) and enable both JRE and JDK 1.8 versions.
This works out finally :) ; give it a try, JDK1.8 64bit in Windows.

Eclipse won't start with Xmx set to 1024m anymore, though there is enough memory

My Eclipse (or, more specific, Spring Tool Suite) version is:
Version: 3.6.3.RELEASE
Build Id: 201411281415
Platform: Eclipse Luna SR1 (4.4.1)
It worked fine, until recently, when I started getting the following error after opening Eclipse:
Error: Could not create the Java Virtual Machine
Error: A fatal exception occured. Program will exit.
My start options include -vm <path to javaw> -vmargs -Xmx1024m -XX:MaxPermSize=256m, I am using jdk1.7.0_79, the 32 bit version, on a 64bit Windows.
I discovered, when setting -Xmx to 768m, Eclipse will start most of the time. I also noticed that starting eclipse began to fail when I installed the MySQL service; if I deactivate it, the Task Manager shows me I have roughly 4gb of 16gb of RAM consumed; with MySQL running, that value increases to 5gb.
What is the reason, when there are 5gb consumed and roughly 11gb of RAM left, that no JDK can be created, and is there a known workaround?
It is likely because of lack of virtual address space. Remember that 32-bit processes have only 2GB of virtual space, which is needed for:
application code
DLLs, both application DLLs and shared DLLs like hooks
java off-heap needs: code caches, buffers, etc.
java heap itself
So, physical RAM is unrelated.
What likely happened?
Eclipse grew heavier so JVM needs more off-heap to function
What you can do?
Uninstall unneeded plugins, shut down your antivirus or other software that could intervene with Eclipse, use 64bit java. 64bit apps are faster on modern processors + 64-bit java uses compressedOps so it could make sense.
In the past i had simlar issues, but no solution. I reached the limit with -Xmx1500m.
See also Maximum Java heap size of a 32-bit JVM on a 64-bit OS.
Is using the 64 bit Version of the JDK no option?

It is failed to create Java Virtual Machine

I got "failed to create JVM" error when I tried to run a jnlp file.
But it works when I removed the max-heap-size="1100m" from Java/j2se tag in jnlp.
It seems something wrong with the max-heap-size. I did some experiments to change the heap size in eclipse.ini file. The biggest heap size I could set is "940M", otherwise I got "Could not create JVM..." error when start the eclipse.
I suspect this is a memory(hardware) problem on my PC. My laptop is pretty new. But for some reason, my admin change the OS from Windows 7 to Windows XP. They now want to change back to windows 7.
I am using JDK 1.6 update 29 and eclipse Version: 3.7.0 Build id: I20110613-1736. Windows xp sp3.
Java requires continuous memory for the heap space. Windows in particular tends to have a limited continuous region of memory available (which is smaller if other programs are running)
I would have thought you can have 1.2 GB heap, but this is far less than the 4 GB a 32-bit application can use in theory.
Switching to a 64-bit JVM on a 64-bit OS is the solution. This will allow you to create a heap space close to the physical memory size.

Categories