You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried enabling ThinLTO on a relatively large project, but the build performance on Windows was much slower than expected. In practice, ThinLTO build time was almost the same as FullLTO, which seems abnormal given ThinLTO’s design.
After investigating, I found that this may be related to the Windows UCRT implementation of malloc/free. As far as I understand, UCRT’s allocator relies on a global lock, which can significantly limit scalability under multithreaded workloads. This appears to cause ThinLTO’s parallel execution to behave much more like single-threaded execution.
Clang seems to provide a way to replace the default malloc/free with a third-party allocator, but it does not appear that NDK enables this by default on Windows.
As an experiment, I used mimalloc-redirect to replace UCRT’s malloc/free, and the improvement was significant:
Original NDK r30: build time was around 1 hour 20 minutes
Workaround with mimalloc-redirect on NDK r30: build time was around 17 minutes
Based on this, I would suggest that NDK consider using a high-performance allocator by default on Windows instead of the default Windows UCRT allocator, especially for workloads like ThinLTO that depend heavily on parallelism.
I am using a supported NDK
I have checked and the NDK I'm using is currently supported
Activity
nickdesaulniers commentedon Sep 23, 2026
Yeah, I'm currently testing out using jemalloc, since Android already has (an old fork of) it tree.