hbelmiro
hbelmiro

Reputation: 1027

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

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

Upvotes: 7

Views: 747

Answers (2)

naXa stands with Ukraine
naXa stands with Ukraine

Reputation: 37916

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.

Upvotes: 1

Frut Dzentready
Frut Dzentready

Reputation: 132

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.

Upvotes: 2

Related Questions