google / sanitizers

AddressSanitizer, ThreadSanitizer, MemorySanitizer
Other
11.55k stars 1.04k forks source link

Does AddressSanitizerLeakSanitizer support Android? #1516

Open TomesVWhite opened 2 years ago

TomesVWhite commented 2 years ago

I have integrated asan in the project, packaged it into apk, installed it on the mobile phone, other memory errors can be detected, only the memory leak in the sample cannot be detected. The same memory leak code, compiled into a.out, can capture the leak normally when running on the linux platform.

SunnySun852963 commented 2 years ago

I tried it in OSx, also can not detect memory leak. Seems only take effect in linux.

hunter-kk commented 2 years ago

I tried it in OSx, also can not detect memory leak. Seems only take effect in linux.

Built-in Clang / LLVM shipped by Xcode does not support Leak Santizer (-fsantize=leak) feature.

hunter-kk commented 2 years ago

379 The management said there was no time to deal with the problems.

srikanth007m commented 2 years ago

@hua-hua-lin Does android 13/ latest Clang supports Leak sanitizer on Android?

hunter-kk commented 2 years ago

@srikanth007m Maybe you can try it on the NDK25 version

srikanth007m commented 1 year ago

@hua-hua-lin If i want to enable Lsan globally. What flag should i need to use in Android build system?

hunter-kk commented 1 year ago

@hua-hua-lin If i want to enable Lsan globally. What flag should i need to use in Android build system?

add ASAN_OPTIONS=detect_leaks=1, When you run the executable file.

./a.out ASAN_OPTIONS=detect_leaks=1
th1nk3r-ing commented 2 months ago

ASAN still not support mem-leak-detect on Android-14 with ndk-r25 ...