Ideas for debugging not-on-heap memory leak?

Answered

I'm seeing a strange, but consistent, memory leak in IntelliJ IDEA CE 2019.3 (existed since at least 2019.2, if not further back). Properties of this leak:

- Shows up in Mac OS X Activity Manager as growing memory use (have seen it grow up to 12GB). Always grows, does not shrink.

- Not related to heap use? (My IDEA heap is set to 3G, and heap dumps during high mem usage don't show either on-heap or off-heap allocation reflecting that memory usage.)

- Clears up by restarting IntelliJ.

Has anyone else run into a similar kind of leak? Any thoughts on what this might be and/or debugging tips?

0
2 comments

See https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr007.html .

Probably worth to look at the number and properties (capacity) of MappedByteBuffer instances in heap dump first (such as DirectByteBuffer).

Do you observe the high Virtual Memory size?

You shouldn’t worry too much on virtual memory usage. We know about some leakage on JVM level though we are at the initial stage of locating the problem.

If Real/Private memory is fine, I'd just ignore it.

0
Avatar
Permanently deleted user

Will try out the native memory tracking, didn't have it turned on for last bounce.

An example of memory usage output from vmmap: https://gist.github.com/henryptung/2a58db9924ab97b13a195f1764e66125

(one printout from ~9G mem usage, one printout fresh after restart). Heap size is 3G.

Looking in a YourKit dump from around the same time (pre-restart), I only see about 610M of DirectByteBuffers.

EDIT: Attempting to enable NMT, but to no avail. I do see:

2019-12-17 19:30:12,954 [ 235] INFO - #com.intellij.idea.Main - JVM Args: -Xms128m -Xmx3072m -XX:ReservedCodeCacheSize=240m -XX:+UseCompressedOops -Dfile.encoding=UTF-8 -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -e
a -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Xverify:none -XX:ErrorFile=/Users/htung/java_error_in_idea_%p.log -XX:HeapDumpPath=/Users/htung/java_error_in_
idea.hprof -Xbootclasspath/a:../lib/boot.jar -XX:NativeMemoryTracking=detail -Djb.vmOptionsFile=/Users/htung/Library/Preferences/IdeaIC2019.3/idea.vmoptions -Didea.home.path=/Applications/IntelliJ IDEA CE.app/Contents -Didea.executable=id
ea -Didea.platform.prefix=Idea -Didea.paths.selector=IdeaIC2019.3

in idea.log. But there's no jcmd under JBR (/Applications/IntelliJ IDEA CE.app/Contents/jbr/Contents/Home/bin), and using another Java 11 JVM on my box:

$ /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home/bin/jcmd 25251 VM.native_memory baseline
25251:
Native memory tracking is not enabled

EDIT 2: Worth noting that the leak is definitely "real", and will choke up my 16GB RAM Mac if allowed to do so.

0

Please sign in to leave a comment.