bytedance / memory-leak-detector

Other
1.09k stars 178 forks source link

使用std::make_unique创建的对象,无法检测到泄漏 #21

Closed fancychendong closed 3 years ago

fancychendong commented 3 years ago
extern "C" JNIEXPORT void JNICALL
Java_com_xxxx_filament_ObjAssimpLoader_nLoad(JNIEnv *env, jclass, jstring path, jlong nativeEngine) {
    g_meshSet = std::make_unique<ObjMeshAssimp>(*((Engine*)nativeEngine));
    utils::Path filename = env->GetStringUTFChars(path, 0);
    g_meshSet->addFromFile(filename, g_materialInstances, true);
    //人为制造一个内存泄漏对象
    std::unique_ptr<ObjMeshAssimp> temp = std::make_unique<ObjMeshAssimp>(*((Engine*)nativeEngine));
}

大佬,问下,我集成这个工具后,生成report,并没有找到我泄漏的so代码行号,唯一相关的so信息如下:

0x00000076e2647000, 4096, 1
0x0000000000214cc0 /data/app/com.xxxx.filament.textured-OlqQ08eyhNALYGjMKOUN6w==/lib/arm64/libfilament_jni.so (std::__ndk1::deque<unsigned int, std::__ndk1::allocator<unsigned int> >::__add_back_capacity())

0x00000076e2ba9000, 4096, 1
0x00000000003127c8 /system/lib64/libart.so (art::jit::JitCodeCache::AddProfilingInfoInternal(art::Thread*, art::ArtMethod*, std::__1::vector<unsigned int, std::__1::allocator<unsigned int> > const&) + 276)
0x0000000000312680 /system/lib64/libart.so (art::jit::JitCodeCache::AddProfilingInfo(art::Thread*, art::ArtMethod*, std::__1::vector<unsigned int, std::__1::allocator<unsigned int> > const&, bool) + 132)
0x0000000000322c14 /system/lib64/libart.so (art::ProfilingInfo::Create(art::Thread*, art::ArtMethod*, bool) + 372)
0x0000000000309040 /system/lib64/libart.so (art::jit::Jit::AddSamples(art::Thread*, art::ArtMethod*, unsigned short, bool) + 504)
0x0000000000280394 /system/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*) + 180)
0x000000000027a444 /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) + 972)
0x0000000000526f0c /system/lib64/libart.so (MterpInvokeVirtual + 592)
0x000000000054a598 /system/lib64/libart.so (ExecuteMterpImpl + 14232)
0x0000000000254148 /system/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool) (.llvm.3404100416) + 492)
0x0000000000259c3c /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*) + 220)
0x000000000027a428 /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) + 944)
0x0000000000526f0c /system/lib64/libart.so (MterpInvokeVirtual + 592)
0x000000000054a598 /system/lib64/libart.so (ExecuteMterpImpl + 14232)
0x0000000000254148 /system/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool) (.llvm.3404100416) + 492)

但是这看起来像是系统编译的内存信息

fancychendong commented 3 years ago

应该是出错了E/RAPHAEL: invoke failed at xdl_sym 机型是三星 galaxy s8, android 9

shentianzhou commented 3 years ago

阈值设置过大