Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Profiling JNI applications

How do we track memory allocation in a Java application that makes use of JNI layer. More specifically if the underlying C code does some memory allocation, can we track those allocations using some profiler [Eclipse/Netbeans].

like image 432
Swaranga Sarma Avatar asked Feb 06 '11 14:02

Swaranga Sarma


People also ask

What is JNI used for?

JNI is the Java Native Interface. It defines a way for the bytecode that Android compiles from managed code (written in the Java or Kotlin programming languages) to interact with native code (written in C/C++).

What is Jclass in JNI?

typedef jobject jclass; In C++, JNI introduces a set of dummy classes to enforce the subtyping relationship. For example: class _jobject {}; class _jclass : public _jobject {}; ...

What is JNI Bridge?

Introduction to Java Native Interface: Establishing a bridge between Java and C/C++ JNI (Java Native Interface) is a foreign function interface that allows code running on JVM to call (or be called by) native applications. Using JNI, one can call methods written in C/C++ or even access assembly language.

What JNI calls?

In software design, the Java Native Interface (JNI) is a foreign function interface programming framework that enables Java code running in a Java virtual machine (JVM) to call and be called by native applications (programs specific to a hardware and operating system platform) and libraries written in other languages ...


1 Answers

It should be possible to track those allocations using a native framework like Valgrind.

Running a JNI application in the Sun VM under Valgrind

like image 164
fglez Avatar answered Nov 09 '22 09:11

fglez