JDK-8355960 : JvmtiAgentList::Iterator dtor double free with -fno-elide-constructors
  • Type: Bug
  • Component: hotspot
  • Sub-Component: jvmti
  • Affected Version: 25
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2025-04-30
  • Updated: 2025-07-10
  • Resolved: 2025-07-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 26
26 b06Fixed
Related Reports
Relates :  
Description
While using a debug build with -fno-elide-constructors turned on, which turns off C++ Return Value Optimization, I get a crash because the JvmtiAgentList::Iterator destructor frees the same _stack object twice.  This happens because code like

Iterator it = xrun_agents();

creates a temprary object.  My understanding is that Return Value Optimization is not guaranteed with C++14, so we should not be relying on it for code correctness.
Comments
Changeset: 03526e25 Branch: master Author: Alex Menkov <amenkov@openjdk.org> Date: 2025-07-08 19:30:07 +0000 URL: https://git.openjdk.org/jdk/commit/03526e250dfb9ac61f50f482b5dfb330e7fec1bf
08-07-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/26083 Date: 2025-07-02 01:47:59 +0000
02-07-2025

ILW=HLM=P3
06-05-2025