Is it possible to change the priority of garbage Collector thread?

后端 未结 4 1000
花落未央
花落未央 2021-01-07 12:41

Java garbage collector runs with priority 1, due to which it is not guaranteed that System.gc() will actually execute if called.

Is there any way to change its prio

4条回答
  •  日久生厌
    2021-01-07 13:28

    The GC will run as required. You shouldn't need to call it manually. If you don't like when it is run you can control it with command line arguments.

    If you believe you have a problem with the behaviour of the GC you should try to fix the cause rather than trying to write your own work around.

    In summary, you should tell us what is the real cause of your concern so we can address that.

提交回复
热议问题