RFR: 8310037: Leak MutableSpaceUsedHelper in parallel GC's SpaceCounters class

Thomas Schatzl tschatzl at openjdk.org
Thu Jun 15 08:44:02 UTC 2023


On Wed, 14 Jun 2023 16:14:15 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:

> Please review this small fix for memory leak.

The change is good, and I'm approving it. The same issue exists for serial gc (in `CSpaceCounters`), so maybe this could be dealt with here too, but feel free to defer to a separate CR.

Fwiw, this seems to be one of those memory leaks of (single) instances that would be cleaned out automatically at VM exit anyway, am I correct?

src/hotspot/share/gc/parallel/spaceCounters.cpp line 65:

> 63:     _perf_used_helper = new MutableSpaceUsedHelper(_object_space);
> 64:     _used = PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes,
> 65:                                     _perf_used_helper,

The same issue affects serial gc in the `CSpaceCounters` file; since these are very minor changes, could you do this in the same change (renaming the CR too)?
Otherwise please file a bug for serial gc too.

src/hotspot/share/gc/parallel/spaceCounters.cpp line 65:

> 63:     _perf_used_helper = new MutableSpaceUsedHelper(_object_space);
> 64:     _used = PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes,
> 65:                                     _perf_used_helper,

Pre-existing: the formatting of `PerfDataManager::create*` calls is rather unusual. I filed [JDK-8310116](https://bugs.openjdk.org/browse/JDK-8310116) for that.

-------------

Marked as reviewed by tschatzl (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/14472#pullrequestreview-1481012551
PR Review Comment: https://git.openjdk.org/jdk/pull/14472#discussion_r1230649832
PR Review Comment: https://git.openjdk.org/jdk/pull/14472#discussion_r1230651103


More information about the hotspot-gc-dev mailing list