Java Memory : Runtime.getRuntime().maxMemory()

前端 未结 2 452
面向向阳花
面向向阳花 2021-01-21 16:31
Runtime.getRuntime().maxMemory() 

shows which memory ? Is it Survivor , Eden , Old, Permanent ?

2条回答
  •  隐瞒了意图╮
    2021-01-21 17:25

    It is the maximum size of the heap. It is loosely based on the -mx or -Xmx command line argument but for reasons I don't understand can be 1-5% less (It doesn't seem to be ever exactly the same)

    What this doesn't include is the perm gen, the direct memory, memory mapped files, stack spaces or shared libraries.

    While it doesn't include everything is it usually 80-90% the total memory usable for most applications.

提交回复
热议问题