Java using up far more memory than allocated with -Xmx

前端 未结 5 1720
轻奢々
轻奢々 2020-12-25 11:45

I have a project I\'m writing (in Java) for a class where the prof says we\'re not allowed to use more than 200m I limit the stack memory to 50m (just to be absolutely sure)

5条回答
  •  鱼传尺愫
    2020-12-25 12:36

    Top command reflects the total amount of memory used by the Java application. This includes among other things:

    • A basic memory overhead of the JVM itself
    • the heap space (bounded with -Xmx)
    • The permanent generation space (-XX:MaxPermSize - not standard in all JVMs)
    • threads stack space (-Xss per stack) which may grow significantly depending on the number of threads
    • Space used by native allocations (using ByteBufer class, or JNI)

提交回复
热议问题