Burst memory usage in Java

前端 未结 8 2216
臣服心动
臣服心动 2021-02-03 23:57

I am trying to get a handle on proper memory usage and garbage collection in Java. I\'m not a novice programmer by any means, but it always seems to me that once Java touches so

8条回答
  •  暖寄归人
    2021-02-04 00:32

    Most JVMs do not or are not able to release previously acquired memory back to the host OS if it isn't needed atm. This is because it's a costly and complex task. The garbage collector only applies to the heap memory within the Java virtual machine. Therefore it does not give back (free() in C terms) memory to the OS. E.g. if a big object isn't used any more, the memory will be marked as free within the heap of the JVM by the GC and not released to OS.

提交回复
热议问题