diff --git a/.gitattributes b/.gitattributes index acdbdbf4..1534e778 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,6 +2,7 @@ * text eol=lf *.png binary *.pdn binary +*.jpg binary *.sln binary *.suo binary *.vcproj binary diff --git a/CMakeLists.txt b/CMakeLists.txt index a9fdb259..b4ef85d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -186,8 +186,11 @@ if(CMAKE_C_COMPILER_ID MATCHES "AppleClang|Clang|GNU|Intel" AND NOT CMAKE_SYSTEM endif() # Architecture flags -if(${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "arm") - list(APPEND mi_cflags -march=native) +if(${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "arm" AND NOT APPLE) + check_cxx_compiler_flag(-march=native CXX_SUPPORTS_MARCH_NATIVE) + if (CXX_SUPPORTS_MARCH_NATIVE) + list(APPEND mi_cflags -march=native) + endif() endif() # extra needed libraries diff --git a/doc/bench-c5-18xlarge-2020-01-20-a.svg b/doc/bench-c5-18xlarge-2020-01-20-a.svg index 0e550935..90050974 100644 --- a/doc/bench-c5-18xlarge-2020-01-20-a.svg +++ b/doc/bench-c5-18xlarge-2020-01-20-a.svg @@ -1,6 +1,7 @@ + diff --git a/doc/bench-c5-18xlarge-2020-01-20-b.svg b/doc/bench-c5-18xlarge-2020-01-20-b.svg index 22bfa5c2..2d853edc 100644 --- a/doc/bench-c5-18xlarge-2020-01-20-b.svg +++ b/doc/bench-c5-18xlarge-2020-01-20-b.svg @@ -1,6 +1,7 @@ + diff --git a/doc/bench-c5-18xlarge-2020-01-20-rss-a.svg b/doc/bench-c5-18xlarge-2020-01-20-rss-a.svg index 6b15ebe5..393bfad9 100644 --- a/doc/bench-c5-18xlarge-2020-01-20-rss-a.svg +++ b/doc/bench-c5-18xlarge-2020-01-20-rss-a.svg @@ -1,6 +1,7 @@ + diff --git a/doc/bench-c5-18xlarge-2020-01-20-rss-b.svg b/doc/bench-c5-18xlarge-2020-01-20-rss-b.svg index e3eb774c..419dc250 100644 --- a/doc/bench-c5-18xlarge-2020-01-20-rss-b.svg +++ b/doc/bench-c5-18xlarge-2020-01-20-rss-b.svg @@ -1,6 +1,7 @@ + diff --git a/doc/bench-r5a-1.svg b/doc/bench-r5a-1.svg index 127d6de8..c296a048 100644 --- a/doc/bench-r5a-1.svg +++ b/doc/bench-r5a-1.svg @@ -1,6 +1,7 @@ + diff --git a/doc/bench-r5a-12xlarge-2020-01-16-a.svg b/doc/bench-r5a-12xlarge-2020-01-16-a.svg index b110ff47..b8a2f20e 100644 --- a/doc/bench-r5a-12xlarge-2020-01-16-a.svg +++ b/doc/bench-r5a-12xlarge-2020-01-16-a.svg @@ -1,6 +1,7 @@ + diff --git a/doc/bench-r5a-12xlarge-2020-01-16-b.svg b/doc/bench-r5a-12xlarge-2020-01-16-b.svg index f7a3287e..4a7e21e7 100644 --- a/doc/bench-r5a-12xlarge-2020-01-16-b.svg +++ b/doc/bench-r5a-12xlarge-2020-01-16-b.svg @@ -1,6 +1,7 @@ + diff --git a/doc/bench-r5a-2.svg b/doc/bench-r5a-2.svg index 8b7b2da4..917ea573 100644 --- a/doc/bench-r5a-2.svg +++ b/doc/bench-r5a-2.svg @@ -1,6 +1,7 @@ + diff --git a/doc/bench-r5a-rss-1.svg b/doc/bench-r5a-rss-1.svg index 1c7f8566..375ebd20 100644 --- a/doc/bench-r5a-rss-1.svg +++ b/doc/bench-r5a-rss-1.svg @@ -1,6 +1,7 @@ + diff --git a/doc/bench-r5a-rss-2.svg b/doc/bench-r5a-rss-2.svg index e819884d..cb2bbc89 100644 --- a/doc/bench-r5a-rss-2.svg +++ b/doc/bench-r5a-rss-2.svg @@ -1,6 +1,7 @@ + diff --git a/doc/ds-logo.jpg b/doc/ds-logo.jpg new file mode 100644 index 00000000..853a7279 Binary files /dev/null and b/doc/ds-logo.jpg differ diff --git a/include/mimalloc-atomic.h b/include/mimalloc-atomic.h index b6506075..9f464593 100644 --- a/include/mimalloc-atomic.h +++ b/include/mimalloc-atomic.h @@ -282,16 +282,22 @@ static inline void mi_atomic_yield(void) { YieldProcessor(); } #elif (defined(__GNUC__) || defined(__clang__)) && \ - (defined(__x86_64__) || defined(__i386__) || defined(__arm__) || defined(__aarch64__)) + (defined(__x86_64__) || defined(__i386__) || (defined(__arm__) && __ARM_ARCH__ >= 7) || defined(__aarch64__)) #if defined(__x86_64__) || defined(__i386__) static inline void mi_atomic_yield(void) { __asm__ volatile ("pause" ::: "memory"); } -#elif defined(__arm__) || defined(__aarch64__) +#elif (defined(__arm__) && __ARM_ARCH__ >= 7) || defined(__aarch64__) static inline void mi_atomic_yield(void) { - __asm__ volatile("yield"); + __asm__ volatile("yield" ::: "memory"); } #endif +#elif defined(__sun) +// Fallback for other archs +#include +static inline void mi_atomic_yield(void) { + smt_pause(); +} #elif defined(__wasi__) #include static inline void mi_atomic_yield(void) { @@ -305,4 +311,4 @@ static inline void mi_atomic_yield(void) { #endif -#endif // __MIMALLOC_ATOMIC_H \ No newline at end of file +#endif // __MIMALLOC_ATOMIC_H diff --git a/include/mimalloc-override.h b/include/mimalloc-override.h index 201fb8b4..2362bfbc 100644 --- a/include/mimalloc-override.h +++ b/include/mimalloc-override.h @@ -24,7 +24,7 @@ not accidentally mix pointers from different allocators). #define free(p) mi_free(p) #define strdup(s) mi_strdup(s) -#define strndup(s) mi_strndup(s) +#define strndup(s,n) mi_strndup(s,n) #define realpath(f,n) mi_realpath(f,n) // Microsoft extensions @@ -33,7 +33,7 @@ not accidentally mix pointers from different allocators). #define _recalloc(p,n,c) mi_recalloc(p,n,c) #define _strdup(s) mi_strdup(s) -#define _strndup(s) mi_strndup(s) +#define _strndup(s,n) mi_strndup(s,n) #define _wcsdup(s) (wchar_t*)mi_wcsdup((const unsigned short*)(s)) #define _mbsdup(s) mi_mbsdup(s) #define _dupenv_s(b,n,v) mi_dupenv_s(b,n,v) diff --git a/readme.md b/readme.md index 9419a658..18d50636 100644 --- a/readme.md +++ b/readme.md @@ -102,6 +102,8 @@ free list encoding](https://github.com/microsoft/mimalloc/blob/783e3377f79ee82af Special thanks to: +* [David Carlier](https://devnexen.blogspot.com/) (@devnexen) for his many contributions, and making + mimalloc work better on many less common operating systems, like Haiku, Dragonfly, etc. * Mary Feofanova (@mary3000), Evgeniy Moiseenko, and Manuel Pöter (@mpoeter) for making mimalloc TSAN checkable, and finding memory model bugs using the [genMC] model checker. * Weipeng Liu (@pongba), Zhuowei Li, Junhua Wang, and Jakub Szymanski, for their early support of mimalloc and deployment @@ -112,6 +114,14 @@ Special thanks to: [genMC]: https://plv.mpi-sws.org/genmc/ +### Usage + +mimalloc is used in various large scale low-latency services and programs, for example: + + + + + # Building ## Windows