Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the java option -XX:-EliminateAllocations do?

What does the java option -XX:-EliminateAllocations do? I couldn't find any documentation about it.

like image 913
hbelmiro Avatar asked Jul 27 '16 12:07

hbelmiro


People also ask

What is the Java heap?

The Java heap is the area of memory used to store objects instantiated by applications running on the JVM. When the JVM is started, heap memory is created and any objects in the heap can be shared between threads as long as the application is running.

How do I see Java memory usage?

Using VisualVM (jvisualvm) jvisualvm is a tool to analyse the runtime behavior of your Java application. It allows you to trace a running Java program and see its the memory and CPU consumption. You can also use it to create a memory heap dump to analyze the objects in the heap.

What is the Java heap size?

The default Java heap size is 768 MB, which supports fewer than 50,000 pairs. If you increase the Java heap size by 256 MB, support increases by 25,000 pairs. You can continue to increase the Java heap size until you reach the maximum heap size. The path_prefix /opt/IBM/CSM/wlp/usr/server/csmServer/jvm.

What is memory management in Java?

What is Memory Management In Java? Memory management in Java is the process of allocating working memory space to new objects and properly removing unreferenced objects to create space for those new object allocations.


2 Answers

This key disables "Scalar replacement optimization"

Simply spoken when an object is identified as non-escaping the JVM can replace its allocation on the heap with an allocation of its members on the stack which mitigates the lack of user guided stack allocation. The optimization is enabled by default since JDK 6U23 in the hotspot server compiler.

More info.

like image 59
Frut Dzentready Avatar answered Nov 02 '22 22:11

Frut Dzentready


HotSpot JIT does eliminate local allocations by replacing object fields with variables. The optimization is called Scalar Replacement.
-XX:+EliminateAllocations JVM flag is for controling this optimization and it is ON by default.

like image 39
naXa Avatar answered Nov 02 '22 22:11

naXa