Why does the java8 GC not collect for over 11 hours?

后端 未结 3 1565
我在风中等你
我在风中等你 2020-12-20 06:58

Context: 64 bit Oracle Java SE 1.8.0_20-b26

For over 11 hours, my running java8 app has been accumulating objects in the Tenured generation (close t

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-20 07:27

    Why does the GC not clean up the tenured generation ?

    Because it doesn't need to.

    It looks like your application is accumulating tenured garbage at a relatively slow rate, and there was still plenty of space for tenured objects. The "throughput" collector generally only runs when a space fills up. That is the most efficient in terms of CPU usage ... which is what the throughput collector optimizes for.

    In short, the GC is working as intended.

    If you are concerned by the amount of memory that is being used (because the tenured space is not being collected), you could try running the application with a smaller heap. However, the graph indicates that the application's initial behavior may be significantly different to its steady-state behavior. In other words, your application may require a large heap to start with. If that is the case, then reducing the heap size could stop the application working, or at least make the startup phase a lot slower.

提交回复
热议问题