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

Zhengyu Gu zgu at openjdk.java.net
Mon May 9 12:51:33 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.

Zhengyu Gu has updated the pull request incrementally with one additional commit since the last revision:

  Thomas' suggestion

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/8579/files
  - new: https://git.openjdk.java.net/jdk/pull/8579/files/df1b8c33..8c13d81d

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=8579&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=8579&range=00-01

  Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 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