snmalloc icon indicating copy to clipboard operation
snmalloc copied to clipboard

Android Support

Open SchrodingerZhu opened this issue 5 years ago • 4 comments

I open this issue just to provide some information about android cross compile:

First thing is that, android-ndk do not have backtrace, hence, we need some workaround like chromium.

Second, there is a little difference of the malloc prototype:

SNMALLOC_EXPORT size_t SNMALLOC_NAME_MANGLE(malloc_usable_size)(const void* ptr) 
{
    return Alloc::alloc_size(const_cast<void*>(ptr));
}

With the above changes, I successfully cross compiled for android.

Android (5900059 based on r365631c) clang version 9.0.8 (https://android.googlesource.com/toolchain/llvm-project 207d7abc1a2abf3ef8d4301736d6a7ebc224a290) (based on LLVM 9.0.8svn)
Target: aarch64-unknown-linux-android29
Thread model: posix
InstalledDir: /opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin

It is extremely hard to find a test environment to check whether the allocator is really working, but if you want to have a try, the above workarounds can be useful.

SchrodingerZhu avatar Apr 08 '20 16:04 SchrodingerZhu

I'm going to leave this issue open until we have CI support to test Android support.

mjp41 avatar Apr 18 '20 06:04 mjp41

Preliminary support provided by #171.

mjp41 avatar Apr 18 '20 07:04 mjp41

https://docs.microsoft.com/en-us/azure/devops/pipelines/ecosystems/android?view=azure-devops

SchrodingerZhu avatar Apr 19 '20 00:04 SchrodingerZhu