Why does JVM heap keep growing?

前端 未结 3 450
-上瘾入骨i
-上瘾入骨i 2021-02-08 18:52

I write a simple program and use jconsole.exe to monitor its heap size.

public class HeapTest {
    public static void main(String[] args) {
        while(true)          


        
3条回答
  •  甜味超标
    2021-02-08 19:31

    There is no memory leak here. Replicated it in OSX as well. It would be the book keeping data generated by the normal functioning of the VM including that for the GC. The eden goes up and once the GC occurs, the memory used by the heap (eden) is reduced and the cycle starts again.

    The confusing aspect is that there are no objects being created explictly by the program but it would make sense to expound that the JVM would be doing so and hence the gradual increase in eden space till the next GC.

提交回复
热议问题