Reputation: 31
Problem : I have setted Xms512m and Xmx1024m for running application which intern use C++ native layer for performing other operation, I am getting OutOfMemory exception when running application. I need to know C++ uses which memory (ie from assigned memory Xms512m and Xmx1024m or it uses other than this setted memory).
How to get heap space and stack space for Java and C++ code while running application separately.
Upvotes: 3
Views: 550
Reputation: 11185
The memory allocated to your JVM and the memory used by JNI and native applications are completely different. Tools like VisualVM and Jprofiler can help you determine JVM specific heap usage. If however the memory leak is from JNI or a native application, you should use options like -Xrunjnichk (available on the IBM JDK) to debug JNI calls.
Upvotes: 0
Reputation: 7957
The memory allocated by native code is not in the Java Heap. Your OutOfMemory Exception caused by the java application. OOM is a clue to get you a sign that java app may use more than 1024mb memory. You can make it larger or consider the memory leak problem.
There are some links about memory leak detection:
You can do it simply:
qty:~ qrtt1$ jps 4437 start.jar 10470 Jps
jmap -dump:format=b,file=my_app_heap_data.hprof 4437
Upvotes: 2
Reputation: 16516
You can Use below monitoring applications:
jconsole
javamelody
visualvm
Upvotes: 1