On Wed, 4 Nov 2026 10:30:51 GMT, Serguei Spitsyn <[email protected]> wrote:

>> Timofei Pushkin has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Address the review
>
> src/java.instrument/share/native/libinstrument/InvocationAdapter.c line 435:
> 
>> 433:         result = AGENT_ERROR_STARTFAIL;
>> 434:         /* Java code may retain a link to the native agent, even if an 
>> exception was thrown */
>> 435:         goto releaseAndReturnAfterStartJavaAgent;
> 
> Q: Does this case needs a cleanup as well?

It needs the partial cleanup which `releaseAndReturnAfterStartJavaAgent` 
performs: to free the data allocated in this function and not transferred into 
the agent. The agent itself cannot be safely disposed of here because 
`startJavaAgent` might have already provided access to it to the user code.

> src/java.instrument/share/native/libinstrument/InvocationAdapter.c line 556:
> 
>> 554:     if (!startJavaAgent(agent, env, agentClassJNI, "", 
>> agent->mAgentmainCaller)) {
>> 555:         // Java code may retain a link to the native agent, even if an 
>> exception was thrown
>> 556:         goto releaseAndReturnAfterStartJavaAgent;
> 
> Q: Does this case needs a cleanup as well? (same as at line 432)

Same answer: https://github.com/openjdk/jdk/pull/33608#discussion_r4468440076

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

PR Review Comment: https://git.openjdk.org/jdk/pull/33608#discussion_r4468440076
PR Review Comment: https://git.openjdk.org/jdk/pull/33608#discussion_r4468449095

Reply via email to