microsoft / snmalloc

Message passing based allocator
MIT License
1.58k stars 108 forks source link

Android Support #163

Open SchrodingerZhu opened 4 years ago

SchrodingerZhu commented 4 years ago

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.

mjp41 commented 4 years ago

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

mjp41 commented 4 years ago

Preliminary support provided by #171.

SchrodingerZhu commented 4 years ago

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

mjp41 commented 1 month ago

Is there more we should do here?