On Wed, 2 Jul 2025 01:47:59 GMT, Alex Menkov <amen...@openjdk.org> wrote:
> Currently jvmtiAgentList keeps agents in reversed order (new agents are added > to the head of the list). > To restore original order JvmtiAgentList::Iterator uses GrowableArray > allocated in heap. > Iterators for different agent types are returned by value, and the iterator > class nas no custom copy ctor, so if the constructor not elides, > GrowableArray is deallocated twice. > > The fix updates jvmtiAgentList to keep agents in the original order, agents > are added to the tail. > Iterator now needs only single pointer to next agent. > Additionally removed `JvmtiAgentList::Iterator::next() const` method (it > looks very strange as `next()` is expected to change state of the iterator). > > Testing: tier1..4,hs-tier5-svc This pull request has now been integrated. Changeset: 03526e25 Author: Alex Menkov <amen...@openjdk.org> URL: https://git.openjdk.org/jdk/commit/03526e250dfb9ac61f50f482b5dfb330e7fec1bf Stats: 83 lines in 6 files changed: 23 ins; 35 del; 25 mod 8355960: JvmtiAgentList::Iterator dtor double free with -fno-elide-constructors Reviewed-by: dholmes, sspitsyn ------------- PR: https://git.openjdk.org/jdk/pull/26083