RFR: 8313874 - JNI NewWeakGlobalRef throws exception for null arg

Kim Barrett kbarrett at openjdk.org
Tue Aug 8 12:40:30 UTC 2023


On Tue, 8 Aug 2023 10:40:30 GMT, Oli Gillespie <ogillespie at openjdk.org> wrote:

> According to the JNI spec for NewWeakGlobalRef:
> 
>> Returns NULL if obj refers to null, or if obj was a weak global reference, or if the VM runs out of memory. If the VM runs out of memory, an OutOfMemoryError will be thrown.
> 
> The current behaviour is that `NewWeakGlobalRef(nullptr)` throws an OutOfMemoryError, which it should not.
> 
> (Thanks @dholmes-ora for confirming the issue and suggesting a fix.)

Changes requested by kbarrett (Reviewer).

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

PR Review: https://git.openjdk.org/jdk/pull/15188#pullrequestreview-1567172754


More information about the hotspot-dev mailing list