inlining AllocateHeap()

Yasumasa Suenaga yasuenag at
Thu Mar 12 11:58:15 UTC 2015

Hi all,

I tried to use NMT with details option on OpenJDK7 on RHEL6.6, but I got
address at AllocateHeap() as malloc() caller.

I checked symbol in in OracleJDK8u40 Linux x64, it has

AllocateHeap() is defined as inline function, and it gives CURRENT_PC to
os::malloc(). I guess that implementation expects AllocateHeap() will be

It may occur with GCC (g++) optimization only, however I want to fix it to
analyze native memory with NMT on Linux.

I applied patch as below. This patch makes AllocateHeap() as inline
diff -r af3b0db91659 src/share/vm/memory/allocation.inline.hpp
--- a/src/share/vm/memory/allocation.inline.hpp Mon Mar 09 09:30:16 2015
+++ b/src/share/vm/memory/allocation.inline.hpp Thu Mar 12 20:45:57 2015
@@ -62,11 +62,18 @@
   return p;
+#ifdef __GNUC__
inline char* AllocateHeap(size_t size, MEMFLAGS flags,
     AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) {
   return AllocateHeap(size, flags, CURRENT_PC, alloc_failmode);

+#ifdef __GNUC__
inline char* ReallocateHeap(char *old, size_t size, MEMFLAGS flag,
     AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) {
   char* p = (char*) os::realloc(old, size, flag, CURRENT_PC);

If this patch is accepted, I will file it to JBS and will upload webrev.



More information about the hotspot-runtime-dev mailing list