find which type of garbage collector is running

后端 未结 10 925
旧巷少年郎
旧巷少年郎 2020-12-04 08:58

Post JSE 5 ergonomics is intended to automatically select the appropriate type of garbage collector for you (among other things).

I would like to know if there is an

10条回答
  •  Happy的楠姐
    2020-12-04 09:54

    Here's some info about how to programmatically get GC info, but it looks like it may need the name of the GC beforehand. Troublesome.

    Edit: try ManagementFactory.getGarbageCollectorMXBeans() and iterate through the returned list. One of these will be active.

提交回复
热议问题