jvm-arguments

Which arguments stand for what in JVM memory options?

只谈情不闲聊 提交于 2019-11-27 05:19:41
问题 There a lot of JVM arguments that affect the JVM's memory usage like -Xms, -Xmx, -Xns, -XX:MaxPermSize... What do they do? Are there any more? Which one do I have to increase when I get what error (e.g. OutOfMemoryError , StackOverflowError ...)? I cannot find a good cheat sheet for them - let's create one here. 回答1: -Xms: this option sets the initial and minimum Java heap size. -Xmx: This option sets the maximum Java heap size. The Java heap (the “heap”) is the part of the memory where

Running java with JAVA_OPTS env variable has no effect

陌路散爱 提交于 2019-11-27 03:33:18
In a shell script, I have set the JAVA_OPTS environment variable (to enable remote debugging and increase memory), and then I execute the jar file as follows: export JAVA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=n -Xms512m -Xmx512m" java -jar analyse.jar $* But it seems there is no effect of the JAVA_OPTS env variable as I cannot connect to remote-debugging and I see no change in memory for the JVM. What could be the problem? PS: I cannot use those settings in the java -jar analyse.jar $* command because I process command line arguments in the application. I

Cassandra and Java 9 - ThreadPriorityPolicy=42 is outside the allowed range

风格不统一 提交于 2019-11-27 02:06:40
问题 Very recently I installed JDK 9 and Apache Cassandra from the official site. But now when I start cassandra in foreground, I get this message: apache-cassandra-3.11.1/bin$ ./cassandra -f [0.000s][warning][gc] -Xloggc is deprecated. Will use -Xlog:gc:/home/mmatak/monero/apache-cassandra-3.11.1/logs/gc.log instead. intx ThreadPriorityPolicy=42 is outside the allowed range [ 0 ... 1 ] Improperly specified VM option 'ThreadPriorityPolicy=42' Error: Could not create the Java Virtual Machine. Error

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

这一生的挚爱 提交于 2019-11-27 01:20:13
问题 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 a few different approaches including: <bean id="myBean" class="com.foo.bar.myClass"> <property name="environment"> <value>${environment}</value> </property> </bean> But, when the setter method is invoked in MyClass, the string "${environment}" is

Java Exceptions counter on JVM HotSpot

家住魔仙堡 提交于 2019-11-26 22:30:55
I am wondering is it possible to log every exception which occurs on JVM level without changing application code? By every exception I mean caught and uncaught exception... I would like to analyze those logs later and group them by exception type (class) and simply count exceptions by type. I am using HotSpot ;) Maybe there is smarter why of doing it? For example by any free profiler (YourKit has it but it is not free)? I think that JRockit has exception counter in management console, but don't see anything similar for HotSpot. I believe there are free tools to do it, but even making your own

CMSPermGenSweepingEnabled vs CMSClassUnloadingEnabled

不想你离开。 提交于 2019-11-26 21:25:59
I've kind of asked this question before - What does JVM flag CMSClassUnloadingEnabled actually do? , but this time it's slightly different! If I start a Java VM with the -XX:+CMSPermGenSweepingEnabled flag set, the following message is printed: Please use CMSClassUnloadingEnabled in place of CMSPermGenSweepingEnabled in the future The -XX:+CMSPermGenSweepingEnabled flag is often used to mitigate against PermGen OutOfMemory errors, however I have read elsewhere that people have found that by following the above advice they have still had these errors, but by sticking with -XX:

What is the largest possible heap size with a 64-bit JVM?

别说谁变了你拦得住时间么 提交于 2019-11-26 20:17:20
The theoretical maximum heap value that can be set with -Xmx in a 32-bit system is of course 2^32 bytes, but typically (see: Understanding max JVM heap size - 32bit vs 64bit ) one cannot use all 4GB. For a 64-bit JVM running in a 64-bit OS on a 64-bit machine, is there any limit besides the theoretical limit of 2^64 bytes or 16 exabytes? I know that for various reasons (mostly garbage collection), excessively large heaps might not be wise , but in light of reading about servers with terrabytes of RAM, I'm wondering what is possible . If you want to use 32-bit references, your heap is limited

Java disable dpi-aware not working

冷暖自知 提交于 2019-11-26 19:10:58
问题 I'm trying to run a Java application with -Dsun.java2d.dpiaware=false argument but nothing happens. I expect to have a blurred UI but with normal size of icons and fonts, it seems that this flag does not work. I'm using JDK 1.8.0_45 on Windows 8.1. I found this bug https://bugs.openjdk.java.net/browse/JDK-8080153 but I don't understand how to workaround it. 回答1: Fix for Windows, follow these steps: Create a windows regedit new DWORD Press Windows Button + R, type “regedit”, and then click OK.

Speed tradeoff of Java's -Xms and -Xmx options

让人想犯罪 __ 提交于 2019-11-26 18:53:27
问题 Given these two commands A: $ java -Xms10G -Xmx10G myjavacode input.txt B: $ java -Xms5G -Xmx5G myjavacode input.txt I have two questions: Since command A reserves more memory with its parameters, will A run faster than B? How do -Xmx and -Xms affect the running process and the output of my program? 回答1: It depends on the GC your java is using. Parallel GCs might work better on larger memory settings - I'm no expert on that though. In general, if you have larger memory the less frequent it

What does -XX:MaxPermSize do?

走远了吗. 提交于 2019-11-26 18:06:40
Specifically, why would it help to fix a PermGen OutOfMemoryError issue? Also, bonus points for an answer that points me to the documentation on JVM arguments... The permanent space is where the classes, methods, internalized strings, and similar objects used by the VM are stored and never deallocated (hence the name). This Oracle article succinctly presents the working and parameterization of the HotSpot GC and advises you to augment this space if you load many classes (this is typically the case for application servers and some IDE like Eclipse) : The permanent generation does not have a