Experiences with escape analysis enabled on the JVM

前端 未结 3 1401
情深已故
情深已故 2021-01-12 10:43

I\'ve just tried the -XX:+DoEscapeAnalysis option enabled on a jdk6-u18 VM (on solaris) and had a rather disappointing experience. I\'m running

相关标签:
3条回答
  • 2021-01-12 10:57

    I suggest you try to increase the new generation size, e.g. -XX:NewSize=96M XX:NewRatio=3. Use JVisualVM (included in the JDK), with the Visual GC Plugin to watch how the young and old spaces are utilised.

    0 讨论(0)
  • 2021-01-12 11:06

    1 Did the escape analysis show up as being enabled in JConsole? You need make sure you're running the VM with the -server option. I assume you had this working, but I just thought I'd check.

    2 I don't think escape analysis will help the situation with Scala Actors. You might see a big gain if you do something like:

    def act():Unit = {
       val omgHugeObject = new OMGHugeObject();
       omgHugeObject.doSomethingCrazy();
     }
    

    In the example above the EscapeAnalysis would make it so omgHugeObject could be allocated on the stack instead of the heap and thus not create garbage. I don't think it is likely that the escape analysis will help with actors. Their references will always "escape" to the actor subsystem.

    3 Are you on the most recent release of Scala? There was a memory leak that I believe was fixed in a recent version. This even caused Lift to spawn off its own Actor library that you might look into.

    4 You might try the G1Garbage collector You can enable it with:

    -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC

    0 讨论(0)
  • 2021-01-12 11:08

    from the jdk-u18 release notes:

    Note that Escape analysis-based optimization (-XX:+DoEscapeAnalysis) is disabled in 6u18. This option will be restored in a future Java SE 6 update.

    0 讨论(0)
提交回复
热议问题