问题
What does the java option -XX:-EliminateAllocations do? I couldn't find any documentation about it.
回答1:
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.
回答2:
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.
来源:https://stackoverflow.com/questions/38613390/what-does-the-java-option-xx-eliminateallocations-do