[JNI beginner] watching memory allocation by native code
jduprezFeb 15 2011 — edited Feb 16 2011Hello,
I have a JSE application that uses JNI to access legacy functionality.
While setting up the app's launching parameters, in particular the memory settings, I realize that I have no information as to how much memory the native code allocates. Indeed, I don't even have a proof that the native code is not leaking memory!
I have used both -Xloggc and commercial profling tools in the past, to check my Java apps for memory leaks. But I had not realized back then, that these tools were not giving me stats about anything called "native" ("native heap area", or whatever).
If I am to believe the Oracle documentation (http://www.oracle.com/technetwork/java/javase/memleaks-137499.html#gbyvk), there needs special (non-Java) tooling to measure memory consumption due to allocations in the native code.
- Am I correct that the memory allocated by the native code is not reported by the Java-level tools (e.g. HotSpot's -Xloggc flag)?
Indeed, so far I don't need to trace each allocation spot or allocated object, I just need to monitor the total allocated size, and check it does not grow over time.
In particular, if that total is already included in the total heap as reported by the loggc, and I can witness that the total doesn't drift, I'm fine.
Thanks in advance.
J.
Edited by: jduprez on Feb 15, 2011 5:05 PM