Jemalloc: Java Native Memory profiling shows 100% je_prof_backtrace
Try configuring using the below flags :
./configure --enable-prof --enable-stats --enable-debug --enable-fill
Spring boot application not using jemalloc
When you run sudo
, Java gets root environment which does not have your previously exported LD_PRELOAD
and MALLOC_CONF
.
Try
sudo LD_PRELOAD=/usr/local/lib/libjemalloc.so \
MALLOC_CONF=prof:true,lg_prof_interval:30,lg_prof_sample:17 \
java -jar application.jar
BTW, jemalloc
is not always useful for profiling Java applications, since it cannot show Java stacks (but it is useful for preventing memory leaks caused by the standard allocator).
Try async-profiler as described in this answer.
Also check this post about Java native memory consumption.
Java Native Memory 'Other' section consumes a lot of memory
Your async-profilers arguments seem wrong.
Change event=itimer,Unsafe_AllocateMemory0
to event=Unsafe_AllocateMemory0
async-profiler also has an experimental nativemem
mode specifically for finding native memory leaks. See https://github.com/jvm-profiling-tools/async-profiler/discussions/491 for the details.
Other
section in NMT typically includes off-heap memory allocated with Unsafe.allocateMemory
, in particular, Direct ByteBuffers.
How to track JVM native memory
There are several tools that you can use.
I'll refer to this excellent answer by apangin: Java using much more memory than heap size (or size correctly Docker memory limit)
I strongly encourage you to read all of that but for your question, this in particular is relevant:
There are tools and techniques for investigating issues with Java memory consumption: Native Memory Tracking, pmap, jemalloc, async-profiler.
Related Topics
Why Is 08 Not a Valid Integer Literal in Java
Fill an Array With Random Numbers
Do Threads Created in Java Behave Differently on Windows and Linux
Ugly Fonts in Java Applications on Ubuntu
Why the Operating System Says It Can't Allocate Memory to Jvm When It Has Enough Memory
Find Java_Home and Set It on Rhel
Why Does Java Rmi Keep Connecting to 127.0.1.1. When Ip Is 192.168.X.X
Installing Jdk8 on Ubuntu- "Unable to Locate Package" Update Doesn't Fix
Hadoop Hdfs Showing Ls: '/Home/Hduser/Input/': No Such File or Directory Error
From What Linux Kernel/Libc Version Is Java Runtime.Exec() Safe with Regards to Memory
Shuffle Multiple Files in Same Order
Org.Apache.Commons.Net.Ftp.Parser.Parserinitializationexception: Unknown Parser Type: Linux
How to Get 0-Padded Binary Representation of an Integer in Java
What Does Java.Lang.Thread.Interrupt() Do