RFR: 8286331: jni_GetStringUTFChars() uses wrong heap allocator [v2]

Dean Long dlong at openjdk.java.net
Mon May 9 19:40:50 UTC 2022


On Mon, 9 May 2022 12:51:33 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.
>
> Zhengyu Gu has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Thomas' suggestion

Marked as reviewed by dlong (Reviewer).

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

PR: https://git.openjdk.java.net/jdk/pull/8579


More information about the hotspot-runtime-dev mailing list