RFR: 8286331: jni_GetStringUTFChars() uses wrong heap allocator
Zhengyu Gu
zgu at openjdk.java.net
Fri May 6 22:28:50 UTC 2022
On Fri, 6 May 2022 17:54:45 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:
> jni_GetStringUTFChars() calls `AllocateHeap(length + 1, mtInternal, 0, AllocFailStrategy::RETURN_NULL);` to allocate memory, where it passes `0` as `NativeCallStack` reference, that results construction of `NativeCallStack`.
>
> In `NativeCallStack`'s constructor, it performs stack walk to capture native call stack. This is unnecessary, if NMT detail tracking is not enabled.
>
> It should use `char* AllocateHeap(size_t size,
> MEMFLAGS flags,
> AllocFailType alloc_failmode /* = AllocFailStrategy::EXIT_OOM*/)` heap allocator instead.
>
You are right, filed [JDK-8286346](https://bugs.openjdk.java.net/browse/JDK-8286346).
-------------
PR: https://git.openjdk.java.net/jdk/pull/8579
More information about the hotspot-runtime-dev
mailing list