valgrindを使用して、 jni経由で Java メソッドを呼び出す ac プログラムのメモリ リークをチェックします。しかし、JVM を作成して解放するだけの最も単純なプログラムであっても、valgrindは常にリークを報告します。なにか提案を?
JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
(*jvm)->DestroyJavaVM(jvm);
valgrind の出力:
> ==21794==
> ==21794== HEAP SUMMARY:
> ==21794== in use at exit: 7,596,470 bytes in 1,427 blocks
> ==21794== total heap usage: 45,668 allocs, 44,241 frees, 25,184,437 bytes allocated
> ==21794==
> ==21794== LEAK SUMMARY:
> ==21794== definitely lost: 4,989 bytes in 24 blocks
> ==21794== indirectly lost: 5,234 bytes in 22 blocks
> ==21794== possibly lost: 245,199 bytes in 182 blocks
> ==21794== still reachable: 7,341,048 bytes in 1,199 blocks
> ==21794== suppressed: 0 bytes in 0 blocks
> ==21794== Rerun with --leak-check=full to see details of leaked memory
> ==21794==
> ==21794== For counts of detected and suppressed errors, rerun with: -v
> ==21794== Use --track-origins=yes to see where uninitialised values come from
> ==21794== ERROR SUMMARY: 4040666 errors from 332 contexts (suppressed: 4 from 4)