Integrated: 8313874 - JNI NewWeakGlobalRef throws exception for null arg

Oli Gillespie ogillespie at openjdk.org
Thu Aug 10 09:10:01 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.)

This pull request has now been integrated.

Changeset: 028b3ae1
Author:    Oli Gillespie <ogillespie at openjdk.org>
Committer: Aleksey Shipilev <shade at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/028b3ae1b162bd8f7c340bfa6e9487ca83697955
Stats:     11 lines in 2 files changed: 10 ins; 0 del; 1 mod

8313874: JNI NewWeakGlobalRef throws exception for null arg

Reviewed-by: dholmes, kbarrett, shade

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

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


More information about the hotspot-dev mailing list