On Wed, 14 May 2025 16:05:18 GMT, Ioi Lam <ik...@openjdk.org> wrote: >>> That's what I had in an earlier version, but then there's no code to free >>> the allocated entries, and I am too lazy to write the deallocator. >>> >>> Either way the effect is the same. The trivial amount of memory used by the >>> entries are not reclaimed, but the VM will exit after a finite amount of >>> time anyway, after the cache creation is finish. >>> >> >> It looks like the memory for these entries is never freed even after >> unloading the agents during shutdown. So there memory is never reclaimed. >> And setting `JvmtiAgentList::_list` to nullptr is not really changing that >> behavior. >> >>> I thought intercepting it here is a bit cleaner and avoids the awkward >>> question of freeing the entries. >> >> hmmm...not sure about that. Ideally we should ignore the jvmti options that >> add agents if the JVM is in assembly phase. But we detect the assembly phase >> after jvmti options have been processed. >> IMO clearing the _list is the next best approach. If that doesn't work then >> more intrusive fix like intercepting the `JvmtiAgentList::Iterator`. > > I cleared the `_list` as you suggested.
@iklam thank you for addressing my comments. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25170#discussion_r2089762404