jvm-hotspot

JRE 32bit vs 64bit

纵饮孤独 提交于 2019-11-27 20:16:18
I've been using Java for a while now, and my typical ritual of setting up a new dev machine requires the norm of downloading and installing the latest JDK from Oracle's site. This prompted an unusual question today, does it matter if I use the 32bit or 64bit JRE bundle? From thinking back on it, I've installed both versions before and my normal toolchain plugs happily in (Eclipse). In my day-to-day programming, I do not recall ever having to change something or think about something in a different way just because I was using the 64bit JRE (or targetting the 64bit JRE for that respect). From

AES-NI intrinsics enabled by default?

拥有回忆 提交于 2019-11-27 19:40:24
Oracle has this to say about Java 8 with regards to AES-NI: Hardware intrinsics were added to use Advanced Encryption Standard (AES). The UseAES and UseAESIntrinsics flags are available to enable the hardware-based AES intrinsics for Intel hardware. The hardware must be 2010 or newer Westmere hardware. For example, to enable hardware AES, use the following flags: -XX:+UseAES -XX:+UseAESIntrinsics To disable hardware AES use the following flags: -XX:-UseAES -XX:-UseAESIntrinsics But it does not indicate if AES intrinsics are enabled by default (for processors that support it). So the question

Android application Wi-Fi device - AP connectivity

拥有回忆 提交于 2019-11-27 17:28:23
I am building an application which can transfer data between a mobile and a Wi-Fi device... The mobile has got the AP enabled (through code) and another device connects to this specific network... How can I detect through code to see the details of the devices connected to the network(AP)?** Is there a solution for this? I have seen an application called Wifi Hot spot in HTC Desire that does this functionality of showing the IP addresses of the devices connected to the network. How can this be achieved? Check out Review: Sprint Mobile Hotspot on HTC EVO 4G . It shows an application that can

Difference between JVM and HotSpot?

*爱你&永不变心* 提交于 2019-11-27 16:47:35
What exactly is HotSpot and how does it relate to JVM and OpenJDK? Is it a library? What exactly does it do? Also, what is the difference between OpenJDK and HotSpot? The definition of what exactly is a Java Virtual Machine is stated in the Java Virtual Machine Specification The JVM is by definition a virtual machine , i. e. a software machine that simulates what a real machine does. Like a real machine, it has an instruction set , a virtual computer architecture and an execution model. It is capable of running code written with this virtual instruction set, pretty much like a real machine can

What is the storage cost for a boxed primitive in Java?

懵懂的女人 提交于 2019-11-27 16:04:02
问题 How large, in bytes, is a boxed primitive like java.lang.Integer or java.lang.Character in Java? An int is 4 bytes, a typical pointer is also 4 byte (if not compressed by the JVM). Is the cost for an Integer (without caching) thus 4 bytes + 4 bytes = 8 bytes ? Are there any more hidden fields within the box-object or additional overhead incurred regarding objects (i.e. is there a general cost for objects that I'm not aware of?). I'm not interested in caching issues. I know that Integers

JVM -XX:+StringCache argument?

*爱你&永不变心* 提交于 2019-11-27 15:49:12
问题 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 (correct word?) Strings and when doing something like String concatenation with literals it was not creating new objects, but pulling them from this pool. Has anyone ever used this argument, or can explain why it would be needed? EDIT: I attempted to run a

What do -XX:-PrintGC and XX:-PrintGCDetails flags do?

不打扰是莪最后的温柔 提交于 2019-11-27 13:41:24
I found the JVM flags here . Is there a more detailed explaination of what exactly they do? David Rabinowitz Setting this flags writes all the garbage collections made by the JVM to a log file (or stdout, but then it is less useful), and these can be analysed by tools such as the ones mentioned here . Using this information you can fine tune your garbage collection configuration. Jé Queue Rather on Sun's, use -Xloggc:gc.log to log to a file, -verbose:gc is also a common switch for this. Also, ensure -XX:+PrintGCDetails and -XX:+PrintGCTimeStamps (note the plus + sign). The timestamp switch is

Encourage the JVM to GC rather than grow the heap?

天涯浪子 提交于 2019-11-27 12:48:29
(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 load another 200 mb on the heap. Currently, there is 300mb worth of "collectable" garbage in the heap (we'll assume it's all in the oldest generation.) Under normal operation, the JVM will grow the heap to 700 mb or so, and garbage collect when it gets around to it. What I would like in that situation is for the JVM to gc first, then allocate the new

Where are instance variables of an Object stored in the JVM?

一笑奈何 提交于 2019-11-27 11:44:18
问题 Is an instance variable of an object in Java stored on the stack or method area of the JVM? Also, do we have different instance variable for multiple threads? If it is stored in method area how is instance variable different from static variable storage? 回答1: Stack and heap are the memories allocated by the OS to the JVM that runs in the system. Stack is a memory place where the methods and the local variables are stored. (variable references either primitive or object references are also

Why HotSpot will optimize the following using hoisting?

社会主义新天地 提交于 2019-11-27 10:56:49
问题 In the "Effective Java", the author mentioned that while (!done) i++; can be optimized by HotSpot into if (!done) { while (true) i++; } I am very confused about it. The variable done is usually not a const , why can compiler optimize that way? 回答1: The author assumes there that the variable done is a local variable, which does not have any requirements in the Java Memory Model to expose its value to other threads without synchronization primitives. Or said another way: the value of done won't