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

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

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

相关标签:
2条回答
  • 2021-01-21 17:14

    According to API, Returns the maximum amount of memory that the Java virtual machine will attempt to use. If there is no inherent limit then the value Long.MAX_VALUE will be returned.

    0 讨论(0)
  • 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.

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