RFR: 8306456: Don't leak _worklist's memory in PhaseLive::compute [v3]

Dean Long dlong at openjdk.org
Thu Apr 20 18:29:44 UTC 2023


On Thu, 20 Apr 2023 13:02:23 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

>> `PhaseLive::compute` used to do this: `_worklist = new (_arena) Block_List();`. This allocates the `Block_List` to the `_arena`, but the backing array is allocated on the resource area: `Block_List() : Block_Array(Thread::current()->resource_area()), _cnt(0) {}`. This causes at most 5 worklists and at least 4 worklists to be created and not freed until the compilation is finished. This patch allocates the worklist within `PhaseLive::compute`:s local resource mark.
>
> Johan Sjölen has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
> 
>  - Merge remote-tracking branch 'origin/master' into dontleak-worklist
>  - Fix style and make worklist passed in as argument
>  - Don't leak the worklist in PhaseLive

Looks good.

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

Marked as reviewed by dlong (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/13535#pullrequestreview-1394549616


More information about the hotspot-compiler-dev mailing list