Questions tagged [jvm-arguments]

Command-line options and environment variables that can affect the performance characteristics of the Java Virtual Machine

There are several categories of JVM arguments:

  1. Standard options recognized by the Java application launcher (e.g. -client, -classpath, ...)
  2. Options that begin with -X which are non-standard (not guaranteed to be supported on all VM implementations) and are subject to change without notice in subsequent releases of the JDK (e.g. -Xbootclasspath, -Xms, -Xloggc, ...)
  3. Options that are specified with -XX are not stable and are subject to change without notice (e.g. -XX:+PrintGCDetails, -XX:-UseParallelGC, ...)

References:

703 questions
21
votes
6 answers

How do I read JVM arguments in the Spring applicationContext.xml

I have a JSF web application with Spring and I am trying to figure out a way to reference the JVM arguments from the applicationContext.xml. I am starting the JVM with an environment argument (-Denv=development, for example). I have found and tried…
jinxed
  • 235
  • 1
  • 4
  • 9
21
votes
4 answers

Encourage the JVM to GC rather than grow the heap?

(Note that when I say "JVM", I really mean "Hotspot", and I'm running the latest Java 1.6 update.) Example situation: My JVM is running with -Xmx set to 1gb. Currently, the heap has 500mb allocated, of which 450mb is used. The program needs to…
Electrons_Ahoy
  • 36,743
  • 36
  • 104
  • 127
21
votes
1 answer

Why does the JVM allow to set the "high" value for the IntegerCache, but not the "low"?

We all know that Java has a cache for Integer (and some other types) for number in the range [-128, 127] which are considered to be "commonly used". The cache is designed as follow : private static class IntegerCache { static final int low =…
Jean-François Savard
  • 20,626
  • 7
  • 49
  • 76
20
votes
4 answers

How to set a JVM option in Jenkins globally for every job?

I've recently installed a new JDK (1.7u9), and I got some very strange VerifyErrors. In a thread I found that it could help me if I use a -XX:-UseSplitVerifier magic switch for the compilation. What I would like to do is to set this Java option…
rlegendi
  • 10,466
  • 3
  • 38
  • 50
20
votes
6 answers

JVM -XX:+StringCache argument?

I was recently reading about all the JVM arguments available in JRE 6 [Java VM Options] and saw this : -XX:+StringCache : Enables caching of commonly allocated strings. Now I was always under the impression that Java kept a pool of interned…
Gandalf
  • 9,648
  • 8
  • 53
  • 88
19
votes
5 answers

Why do you need to specify the Java heap size?

I have always wondered, why does Java require you set the heap size manually? I was under the impression that programs written in other languages would just allocate as much memory as needed as the program run until the OS could allocate no…
benstpierre
  • 32,833
  • 51
  • 177
  • 288
17
votes
2 answers

How to add JVM arguments for Spring Boot project in VS Code?

I'm trying out VS Code by moving a project I did on Eclipse to it. I had a run configuration in Eclipse for this project which had the following JVM arguments: --module-path lib/javafx-sdk-13/lib --add-modules=javafx.controls Of course this "lib"…
Martin
  • 1,977
  • 5
  • 30
  • 67
17
votes
1 answer

How can I determine why the Hotspot JVM decided to re-compile already JIT:ed code a second time?

I'm trying to write a warm-up routine for a latency sensitive java application in order to optimize the first few transactions that would otherwise be slowed down by dynamic class loading and JIT (mainly). The problem I'm facing is that even though…
user268744
  • 371
  • 1
  • 8
15
votes
2 answers

GC log rotation data lose on application restart

I use this jvm option in order to create gc logs and enable rolling: $ java -Xloggc:gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 …
alid
  • 163
  • 1
  • 7
14
votes
1 answer

User JVM parameter in log4j2 configuration

I have an RollingFile Appender defined in my log4j2.xml.
Chris
  • 515
  • 2
  • 6
  • 13
14
votes
2 answers

caliper error: CICompilerCount of 1 is invalid; must be at least 2

i have a caliper benchmark (1.0-beta-2): import com.google.caliper.Benchmark; import com.google.caliper.runner.CaliperMain; public class MyBenchmark { @Benchmark public int a(int rep) { return 0; } public static void…
piotrek
  • 13,982
  • 13
  • 79
  • 165
14
votes
7 answers

Multi-thread state visibility in Java: is there a way to turn the JVM into the worst case scenario?

Suppose our code has 2 threads (A and B) have a reference to the same instance of this class somewhere: public class MyValueHolder { private int value = 1; // ... getter and setter } When Thread A does myValueHolder.setValue(7), there is…
Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120
13
votes
1 answer

`Unrecognized VM option 'CMSClassUnloadingEnabled'` after switching to java 17

After changing the Java version to 17 I can't build the Gradle project. I am using Gradle 7.3.1 version and have the following line in Gradle properties: org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xms1g -Xmx4g -XX:+UseG1GC…
Wiktor Kęska
  • 411
  • 2
  • 4
  • 13
13
votes
4 answers

insufficient memory for the Java Runtime Environment to continue though RAM is showing 6 GB free space

While running java application I'm getting the following memory dump. After installing java 8(with java 7 application was working before) I started getting the below error. I'm using 16 GB RAM and in task manager when I checked (while application…
user3305063
  • 461
  • 1
  • 5
  • 15
13
votes
2 answers

JVM PrintGCApplicationConcurrentTime and PrintGCApplicationStoppedTime flags

I'm running a Java program and I need to get how much time each it spent garbage collecting. I found these 2 JVM flags: -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCApplicationStoppedTime but I'm not being able to find information about it.…
franco
  • 297
  • 4
  • 9