RFR: 8312200: Fix Parse::catch_call_exceptions memory leak

Johan Sjölen jsjolen at openjdk.org
Tue Jul 18 11:41:28 UTC 2023


On Tue, 18 Jul 2023 11:33:38 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

> Hi,
> 
> We used to allocate some `GrowableArray`s onto the `node_arena` in `Parse::catch_call_exceptions`. This leaves the allocated memory until the compilation has finished, potentially increasing the maximum memory usage. I've fixed this by allocating the memory on a temporary `Arena` instead. I also switched the `GrowableArray`s themselves to being stack allocated.
> 
> Also a few stylistic issues were addressed.

src/hotspot/share/opto/doCall.cpp line 802:

> 800:     ciExceptionHandler* h       = handlers.handler();
> 801:     int                 h_bci   = h->handler_bci();
> 802:     ciInstanceKlass*    h_klass = h->is_catch_all() ? env()->Throwable_klass() : h->catch_klass();

Reduced the alignment here by 1, I think that `h_extype` used to be put here, which is what caused an unnecessary extra space.

src/hotspot/share/opto/doCall.cpp line 814:

> 812:       }
> 813:     }
> 814:     const Type* h_extype = TypeOopPtr::make_from_klass(h_klass);

Removed the alignment here, as it's far away from the previously declared variables in this scope.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14921#discussion_r1266641979
PR Review Comment: https://git.openjdk.org/jdk/pull/14921#discussion_r1266642512


More information about the hotspot-compiler-dev mailing list