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

主宰稳场 提交于 2020-12-29 12:25:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!