Speed tradeoff of Java's -Xms and -Xmx options

后端 未结 8 1824
北荒
北荒 2020-12-04 08:24

Given these two commands

A:

$ java -Xms10G -Xmx10G myjavacode input.txt

B:

$ java -Xms5G -Xmx5G myjavacode input.tx         


        
8条回答
  •  再見小時候
    2020-12-04 09:16

    I have found that in some cases too much memory can slow the program down.

    For example I had a hibernate based transform engine that started running slowly as the load increased. It turned out that each time we got an object from the db, hibernate was checking memory for objects that would never be used again.

    The solution was to evict the old objects from the session.

    Stuart

提交回复
热议问题