RFR: 8286331: jni_GetStringUTFChars() uses wrong heap allocator
Zhengyu Gu
zgu at openjdk.java.net
Fri May 6 18:02:02 UTC 2022
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.
-------------
Commit messages:
- v0
Changes: https://git.openjdk.java.net/jdk/pull/8579/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8579&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8286331
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.java.net/jdk/pull/8579.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/8579/head:pull/8579
PR: https://git.openjdk.java.net/jdk/pull/8579
More information about the hotspot-dev
mailing list