0

I write a java program which calls some jni APIs in a native libary. The native libary is also written by me. The jdk version is jdk1.7_0_75. From the result of "top" command, I find the memory used by the program keeps going up. I have used "pmap -d" to check the memory mapping and I found a entry in the result of "pmap -d" is quite suspicious. Here is the entry:

00002b3373f63000  162388 rw--- 00002b3373f63000 000:00000   [ anon ]

The value of the second column keeps going up and always goes up by 4k each time I execute the "pmap -d" command. So how should I pinpoint the reason for this memory leak problem? Is it caused by the native code?

yifan
  • 31
  • 5
  • 1
    "Is it caused by the native code?" How can we know since there is no code. We can help you find the issue, but we need to know your code to investigate. – Olivier Grégoire Jan 05 '19 at 01:50
  • @OlivierGrégoire, the native code is too long, two cpp files. I don't know which line of the code could probably cause the problem. How should I show my code to you? – yifan Jan 05 '19 at 02:00
  • 3
    Chances are you don't need all of your code to demonstrate the problem. You need to narrow it down, and you may find the issue yourself while doing so. – Retired Ninja Jan 05 '19 at 02:02
  • Alternatively, see https://stackoverflow.com/questions/33334126/how-to-find-memory-leaks-in-java-jni-c-process, https://stackoverflow.com/questions/8450792/java-performance-tuning-jni-memory-leak, https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/memleaks005.html – Stephen C Jan 05 '19 at 02:10

0 Answers0