On Wed, 21 Oct 2026 01:21:25 GMT, Leonid Mesnik <[email protected]> wrote:

> The SampledObjectAlloc event is called before object is cloned. It might 
> potentially cause the issues because Clone() implementation might rely on the 
> fact that object is not updated before creation an updating by clone. 
> 
> The proposed fix is to call SampledObjectAlloc after clone is completed like 
> it is done for VMObjectAlloc. Thus clone is atomic and can't be interrupted 
> by Java code.
> 
> The JVMTI specification is not specific to the exact time when the event is 
> called. 
> 
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

This pull request has now been integrated.

Changeset: 72163701
Author:    Leonid Mesnik <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/72163701ec8f0b480f02d12142b5a20d6b1de771
Stats:     179 lines in 3 files changed: 179 ins; 0 del; 0 mod

8383787: JVMTI_EVENT_SAMPLED_OBJECT_ALLOC may make a cloned object accessible 
to Java before clone completed

Reviewed-by: ogillespie, sspitsyn

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

PR: https://git.openjdk.org/jdk/pull/33483

Reply via email to