4

I have a shared library that will be called by Java platform via JNI. Would it be possible to check memory leaks in the solib with Valgrnid ?

I tried

valgrind java -cp bin:libs/junit/junit.jar org.junit.runner.JUnitCore com.test.app

==7902== Memcheck, a memory error detector
==7902== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==7902== Using Valgrind-3.8.0 and LibVEX; rerun with -h for copyright info
==7902== Command: java -cp bin:libs/junit/junit.jar org.junit.runner.JUnitCore com.test.FnTestNPVRRemoteBooking
==7902==
JUnit version 4.11-SNAPSHOT-20120805-1225
.
.
.
.
.
end

Valgrind runs but does not print any results, probably because its not meant to run for java applications, but whats the work around ?

In general is there a solution to check memory leaks only on solibs ?

Is it possible to hook Valgrind to a PID (Linux platfrom) ? (I know GDB can be hooked) If yes, will it help my scenario as the App PID will be a Java application.

PS - My app is not meant to run on android, but may be android developers are aware of solution, so adding android tag.

Kamath
  • 4,461
  • 5
  • 33
  • 60
  • You could build a native (and most definitely executable) _test_ application for that shared object too... – 1737973 Aug 07 '14 at 13:11
  • Effort is just too much, not effective as the native app will have to replicate calls and flow from java app. – Kamath Aug 08 '14 at 18:54
  • Effort is _big_ and the more effective the more it can replicate Java calls and flow. – 1737973 Aug 09 '14 at 22:49

0 Answers0