System.gc() calls by core APIs

后端 未结 3 2041
梦谈多话
梦谈多话 2020-12-18 23:10

Some of you probably know that some of core java APIs make explicit calls to System.gc(). I know two cases when this happens:

  1. NIO. I believe that is done to do
3条回答
  •  隐瞒了意图╮
    2020-12-19 00:10

    A JDK implementation knows exactly how its own System.gc() behaves. JDK does not have to pretend to be agnostic, restraining itself to the standard abstract behavior, instead of the concrete proprietary behavior (which is of course compliant with the standard behavior)

    Yes, it can call System.gc() as it sees fit. We shouldn't.

提交回复
热议问题