Question

What libc implementation is used in Android platform? What malloc implementation is used (ptmalloc or tcmalloc or anything other)?

Was it helpful?

Solution

libc is Bionic and malloc is Doug Lea version named dlmalloc (with USE_LOCKS enabled for thread-safety).

Update: dlmalloc was removed in january 2016: https://github.com/android/platform_bionic/commit/c650447239352d43acc2fd99a8579a85ae0469ab https://sourceforge.net/p/android-x86/bionic/ci/0ac0cee0d1ab60a92103a5021e76ec31da2e3234/ "Merge "Remove dlmalloc.""

+libc_malloc_src := bionic/jemalloc_wrapper.cpp
+libc_common_c_includes += external/jemalloc/include

So, Android 7 uses external malloc implementation jemalloc (from FreeBSD/Facebook) - http://jemalloc.net/ and https://github.com/jemalloc/jemalloc; android variant of code is there: https://android.googlesource.com/platform/external/jemalloc/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top