jvm-arguments

What is Java's -XX:+UseMembar parameter

你。 提交于 2019-12-03 11:04:08
I see this parameter in all kinds of places (forums, etc.) and the common answer it help highly concurrent servers. Still, I cannot find an official documentation from sun explaining what it does. Also, was it added in Java 6 or did it exist in Java 5? (BTW, a good place for many hotspot VM parameters is this page ) Update: Java 5 does not boot with this parameter. butterchicken In order to optimise performance, the JVM uses a "pseudo memory barrier" in code to act as a fencing instruction when synchronizing across multiple processors. It is possible to revert back to a "true" memory barrier

Is JVM ARGS '-Xms1024m -Xmx2048m' still useful in Java 8?

▼魔方 西西 提交于 2019-12-03 10:39:00
问题 I have a Java 7 application using JVM ARGS: -Xms1024m -Xmx2048m , and it runs pretty well. After I upgrade to Java 8, it runs in error state with Exception: Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded at org.hibernate.engine.StatefulPersistenceContext.addEntry(StatefulPersistenceContext.java:466) at org.hibernate.engine.TwoPhaseLoad.postHydrate(TwoPhaseLoad.java:80) at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1439) at org.hibernate.loader

Default for XX:MaxDirectMemorySize

此生再无相见时 提交于 2019-12-03 09:30:51
What is the default value for XX:MaxDirectMemorySize? John Gardner From http://www.docjar.com/html/api/sun/misc/VM.java.html i see: 163 // A user-settable upper limit on the maximum amount of allocatable direct 164 // buffer memory. This value may be changed during VM initialization if 165 // "java" is launched with "-XX:MaxDirectMemorySize=<size>". 166 // 167 // The initial value of this field is arbitrary; during JRE initialization 168 // it will be reset to the value specified on the command line, if any, 169 // otherwise to Runtime.getRuntime.maxDirectMemory(). 170 // 171 private static

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

吃可爱长大的小学妹 提交于 2019-12-03 09:08:47
问题 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 no guarantee that Thread B will ever read that value: myValueHolder.getValue() could - in theory - keep returning 1 forever. In practice however, the hardware will clear the second level cache sooner or later, so Thread B will read 7 sooner or later (usually

How do I get an error message when failing to load a JVM via JNI?

a 夏天 提交于 2019-12-03 08:46:00
I would like to retrieve an error message that explains why the jvm failed to load. From the examples provided here: http://java.sun.com/docs/books/jni/html/invoke.html I extracted this example: /* Create the Java VM */ res = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args); if (res < 0) { // retrieve verbose error here? fprintf(stderr, "Can't create Java VM\n"); exit(1); } In my specific case I'm providing invalid arguments in the vm_args and would expect to see what I get on the command line: "Unrecognized option: -foo=bar" On further testing it looks like the jvm is putting the message I want

How to give more memory to IntelliJ Idea 9-11

情到浓时终转凉″ 提交于 2019-12-03 04:04:15
问题 This concerns Intellij from 9 to 11. In the IDEA window On the bottom right corner I see the current memory usage, typically "224M of 254M" How do I give more memory to Idea so it may read like "224M of 512M" ? Thank you. 回答1: On Mac, $IDEA_HOME/Contents/Info.plist ~: grep --context=5 Xmx /Applications/Maia-IU-94.426.app/Contents/Info.plist <string>true</string> <key>apple.awt.fullscreencapturealldisplays</key> <string>false</string> </dict> <key>VMOptions</key> <string>-Xms128m -Xmx912m

Passing an entire file to JVM arguments

浪子不回头ぞ 提交于 2019-12-03 03:30:15
I have several systems that all need to load the same properties to the JVM. I can use the -D flag to load one property at a time, but i am looking for something that will load all the properties in an entire file at one time. For instance: I could just add --options-file=blah.properties to all jvms on my network, once, and from then on only change the properties file, which could be a single central file over a network share. Thank you, EDIT: Any arguments or commands must also work in a windows environment. Therefore any bash or scripting hacks specific to unix will not work. That's roughly

Is JVM ARGS '-Xms1024m -Xmx2048m' still useful in Java 8?

只愿长相守 提交于 2019-12-03 01:12:17
I have a Java 7 application using JVM ARGS: -Xms1024m -Xmx2048m , and it runs pretty well. After I upgrade to Java 8, it runs in error state with Exception: Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded at org.hibernate.engine.StatefulPersistenceContext.addEntry(StatefulPersistenceContext.java:466) at org.hibernate.engine.TwoPhaseLoad.postHydrate(TwoPhaseLoad.java:80) at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1439) at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1332) at org.hibernate.loader.Loader.getRow(Loader.java:1230)

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

时光总嘲笑我的痴心妄想 提交于 2019-12-03 00:46:34
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 no guarantee that Thread B will ever read that value: myValueHolder.getValue() could - in theory - keep returning 1 forever. In practice however, the hardware will clear the second level cache sooner or later, so Thread B will read 7 sooner or later (usually sooner). Is there any way to make the JVM emulate that worst case scenario for which it keeps

JVM performance tuning for large applications

久未见 提交于 2019-12-03 00:16:45
问题 The default JVM parameters are not optimal for running large applications. Any insights from people who have tuned it on a real application would be helpful. We are running the application on a 32-bit windows machine, where the client JVM is used by default. We have added -server and changed the NewRatio to 1:3 (A larger young generation). Any other parameters/tuning which you have tried and found useful? [Update] The specific type of application I'm talking about is a server application that