richgel999 / lzham_codec

Lossless data compression codec with LZMA-like ratios but 1.5x-8x faster decompression speed, C/C++
Other
693 stars 71 forks source link

Android patches - lzham_core.h config & workaround for missing malloc_usable_size() #10

Open fearog opened 9 years ago

fearog commented 9 years ago

There is no malloc_usable_size() equivalent on Android, it was deprecated some time back. So we need to manage tracking allocation sizes ourselves. I chose to do it by including the size as a prefix to the allocation, just like what is done with the array sizes.

I only had a quick look for spin lock, but it appears to be missing on Android. So I disabled pthreads for now on Android.

GregSlazinski commented 5 years ago

On Android API 17 and above, 'malloc_usable_size' is present. however returned addresses from 'malloc' do NOT meet LZHAM_MIN_ALLOC_ALIGNMENT requirements (tested on 64-bit binary). See my own patch here, which is much simpler than proposed solution, https://github.com/Esenthel/EsenthelEngine/commit/e4c5160e2581ffb9da3121787190862fae3509c6#diff-0f68d553aebdf2e6a072f2c0928455f0

gvollant commented 4 years ago

See my own patch here, which is much simpler than proposed solution, Esenthel/EsenthelEngine@e4c5160#diff-0f68d553aebdf2e6a072f2c0928455f0

I suggest you publish another Pull request