diff --git a/CMakeLists.txt b/CMakeLists.txt index f6968ed7..61217cd1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,11 +47,11 @@ if(OVERRIDE MATCHES "ON") list(APPEND mi_defines MI_MALLOC_OVERRIDE) if(APPLE) if(INTERPOSE MATCHES "ON") - # use interpose on MacOSX + # use interpose on macOS message(STATUS " Use interpose to override malloc (INTERPOSE=ON)") list(APPEND mi_defines MI_INTERPOSE) else() - # use zone's on MacOSX + # use zone's on macOS message(STATUS " Use zone's to override malloc (INTERPOSE=OFF)") list(APPEND mi_sources src/alloc-override-osx.c) endif() diff --git a/doc/mimalloc-doc.h b/doc/mimalloc-doc.h index 184e5c5b..69367e66 100644 --- a/doc/mimalloc-doc.h +++ b/doc/mimalloc-doc.h @@ -648,7 +648,7 @@ The `mimalloc` project builds a static library (in `out/msvc-x64`), while the `mimalloc-override` project builds a DLL for overriding malloc in the entire program. -## MacOSX, Linux, BSD, etc. +## macOS, Linux, BSD, etc. We use [`cmake`](https://cmake.org)1 as the build system: @@ -772,14 +772,14 @@ Overriding the standard `malloc` can be done either _dynamically_ or _statically This is the recommended way to override the standard malloc interface. -### Unix, BSD, MacOSX +### Unix, BSD, macOS On these systems we preload the mimalloc shared library so all calls to the standard `malloc` interface are resolved to the _mimalloc_ library. - `env LD_PRELOAD=/usr/lib/libmimalloc.so myprogram` (on Linux, BSD, etc.) -- `env DYLD_INSERT_LIBRARIES=usr/lib/libmimalloc.dylib myprogram` (On MacOSX) +- `env DYLD_INSERT_LIBRARIES=usr/lib/libmimalloc.dylib myprogram` (On macOS) Note certain security restrictions may apply when doing this from the [shell](https://stackoverflow.com/questions/43941322/dyld-insert-libraries-ignored-when-calling-application-through-bash). diff --git a/docs/build.html b/docs/build.html index 79dc2e50..056ce249 100644 --- a/docs/build.html +++ b/docs/build.html @@ -104,7 +104,7 @@ $(document).ready(function(){initNavTree('build.html','');});

Checkout the sources from Github:

git clone https://github.com/microsoft/mimalloc

Windows

Open ide/vs2017/mimalloc.sln in Visual Studio 2017 and build. The mimalloc project builds a static library (in out/msvc-x64), while the mimalloc-override project builds a DLL for overriding malloc in the entire program.

-

MacOSX, Linux, BSD, etc.

+

macOS, Linux, BSD, etc.

We use cmake1 as the build system:

> mkdir -p out/release
> cd out/release
> cmake ../..
> make

This builds the library as a shared (dynamic) library (.so or .dylib), a static library (.a), and as a single object file (.o).

> sudo make install (install the library and header files in /usr/local/lib and /usr/local/include)

diff --git a/docs/overrides.html b/docs/overrides.html index f219ab84..85da82eb 100644 --- a/docs/overrides.html +++ b/docs/overrides.html @@ -105,11 +105,11 @@ $(document).ready(function(){initNavTree('overrides.html','');});

Overriding the standard malloc can be done either dynamically or statically.

Dynamic override

This is the recommended way to override the standard malloc interface.

-

Unix, BSD, MacOSX

+

Unix, BSD, macOS

On these systems we preload the mimalloc shared library so all calls to the standard malloc interface are resolved to the mimalloc library.

  • env LD_PRELOAD=/usr/lib/libmimalloc.so myprogram (on Linux, BSD, etc.)
  • -
  • env DYLD_INSERT_LIBRARIES=usr/lib/libmimalloc.dylib myprogram (On MacOSX)

    +
  • env DYLD_INSERT_LIBRARIES=usr/lib/libmimalloc.dylib myprogram (On macOS)

    Note certain security restrictions may apply when doing this from the shell.

diff --git a/include/mimalloc-internal.h b/include/mimalloc-internal.h index 29a1b89a..1d08b685 100644 --- a/include/mimalloc-internal.h +++ b/include/mimalloc-internal.h @@ -147,7 +147,7 @@ extern mi_decl_thread mi_heap_t* _mi_heap_default; // default heap to allocate static inline mi_heap_t* mi_get_default_heap() { #ifdef MI_TLS_RECURSE_GUARD - // on some platforms, like MacOSX, the dynamic loader calls `malloc` + // on some platforms, like macOS, the dynamic loader calls `malloc` // to initialize thread local data. To avoid recursion, we need to avoid // accessing the thread local `_mi_default_heap` until our module is loaded // and use the statically allocated main heap until that time. @@ -301,7 +301,7 @@ static inline uintptr_t _mi_thread_id() mi_attr_noexcept { #if defined(__i386__) __asm__("movl %%gs:0, %0" : "=r" (tid) : : ); // 32-bit always uses GS #elif defined(__MACH__) - __asm__("movq %%gs:0, %0" : "=r" (tid) : : ); // x86_64 MacOSX uses GS + __asm__("movq %%gs:0, %0" : "=r" (tid) : : ); // x86_64 macOS uses GS #elif defined(__x86_64__) __asm__("movq %%fs:0, %0" : "=r" (tid) : : ); // x86_64 Linux, BSD uses FS #elif defined(__arm__) diff --git a/readme.md b/readme.md index d8283adf..4bf990c7 100644 --- a/readme.md +++ b/readme.md @@ -61,7 +61,7 @@ The `mimalloc` project builds a static library (in `out/msvc-x64`), while the `mimalloc-override` project builds a DLL for overriding malloc in the entire program. -## MacOSX, Linux, BSD, etc. +## macOS, Linux, BSD, etc. We use [`cmake`](https://cmake.org)1 as the build system: @@ -182,14 +182,14 @@ Overriding the standard `malloc` can be done either _dynamically_ or _statically This is the recommended way to override the standard malloc interface. -### Unix, BSD, MacOSX +### Unix, BSD, macOS On these systems we preload the mimalloc shared library so all calls to the standard `malloc` interface are resolved to the _mimalloc_ library. - `env LD_PRELOAD=/usr/lib/libmimalloc.so myprogram` (on Linux, BSD, etc.) -- `env DYLD_INSERT_LIBRARIES=usr/lib/libmimalloc.dylib myprogram` (On MacOSX) +- `env DYLD_INSERT_LIBRARIES=usr/lib/libmimalloc.dylib myprogram` (On macOS) Note certain security restrictions may apply when doing this from the [shell](https://stackoverflow.com/questions/43941322/dyld-insert-libraries-ignored-when-calling-application-through-bash). diff --git a/src/alloc-override-osx.c b/src/alloc-override-osx.c index 7e263981..6a48a15c 100644 --- a/src/alloc-override-osx.c +++ b/src/alloc-override-osx.c @@ -11,11 +11,11 @@ terms of the MIT license. A copy of the license can be found in the file #if defined(MI_MALLOC_OVERRIDE) #if !defined(__APPLE__) -#error "this file should only be included on MacOSX" +#error "this file should only be included on macOS" #endif /* ------------------------------------------------------ - Override system malloc on MacOSX + Override system malloc on macOS This is done through the malloc zone interface. ------------------------------------------------------ */ @@ -161,7 +161,7 @@ static malloc_zone_t* mi_get_default_zone() } -static void __attribute__((constructor)) _mi_macosx_override_malloc() +static void __attribute__((constructor)) _mi_macos_override_malloc() { static malloc_introspection_t intro; memset(&intro, 0, sizeof(intro)); @@ -194,7 +194,7 @@ static void __attribute__((constructor)) _mi_macosx_override_malloc() #if defined(MAC_OS_X_VERSION_10_6) && \ MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 - // rwitch to version 9 on OSX 10.6 to support memalign. + // switch to version 9 on OSX 10.6 to support memalign. zone.version = 9; zone.memalign = &zone_memalign; zone.free_definite_size = &zone_free_definite_size; diff --git a/src/stats.c b/src/stats.c index 7b8de6ce..1f659578 100644 --- a/src/stats.c +++ b/src/stats.c @@ -312,10 +312,10 @@ static double mi_clock_now() { } #else #include -#ifdef TIME_UTC +#ifdef CLOCK_REALTIME static double mi_clock_now() { struct timespec t; - timespec_get(&t, TIME_UTC); + clock_gettime(CLOCK_REALTIME, &t); return (double)t.tv_sec + (1.0e-9 * (double)t.tv_nsec); } #else