mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-06 15:29:31 +03:00
merge from dev
This commit is contained in:
commit
10ce8839fa
30 changed files with 66 additions and 52 deletions
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2019 Microsoft Corporation, Daan Leijen
|
Copyright (c) 2018-2021 Microsoft Corporation, Daan Leijen
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
Copyright (c) 2018, Microsoft Research, Daan Leijen
|
Copyright (c) 2018-2021, Microsoft Research, Daan Leijen
|
||||||
This is free software; you can redistribute it and/or modify it under the
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the MIT license. A copy of the license can be found in the file
|
terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
Copyright (c) 2018,2020 Microsoft Research, Daan Leijen
|
Copyright (c) 2018-2021 Microsoft Research, Daan Leijen
|
||||||
This is free software; you can redistribute it and/or modify it under the
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the MIT license. A copy of the license can be found in the file
|
terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
Copyright (c) 2018, Microsoft Research, Daan Leijen
|
Copyright (c) 2018-2021, Microsoft Research, Daan Leijen
|
||||||
This is free software; you can redistribute it and/or modify it under the
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the MIT license. A copy of the license can be found in the file
|
terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
|
@ -216,8 +216,16 @@ static inline uintptr_t _mi_align_up(uintptr_t sz, size_t alignment) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Align downwards
|
||||||
static inline uintptr_t _mi_align_down(uintptr_t sz, size_t alignment) {
|
static inline uintptr_t _mi_align_down(uintptr_t sz, size_t alignment) {
|
||||||
return (sz / alignment) * alignment;
|
mi_assert_internal(alignment != 0);
|
||||||
|
uintptr_t mask = alignment - 1;
|
||||||
|
if ((alignment & mask) == 0) { // power of two?
|
||||||
|
return (sz & ~mask);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return ((sz / alignment) * alignment);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Divide upwards: `s <= _mi_divide_up(s,d)*d < s+d`.
|
// Divide upwards: `s <= _mi_divide_up(s,d)*d < s+d`.
|
||||||
|
@ -305,7 +313,7 @@ extern bool _mi_process_is_initialized;
|
||||||
mi_heap_t* _mi_heap_main_get(void); // statically allocated main backing heap
|
mi_heap_t* _mi_heap_main_get(void); // statically allocated main backing heap
|
||||||
|
|
||||||
#if defined(MI_MALLOC_OVERRIDE)
|
#if defined(MI_MALLOC_OVERRIDE)
|
||||||
#if defined(__MACH__) // OSX
|
#if defined(__APPLE__) // macOS
|
||||||
#define MI_TLS_SLOT 89 // seems unused?
|
#define MI_TLS_SLOT 89 // seems unused?
|
||||||
// other possible unused ones are 9, 29, __PTK_FRAMEWORK_JAVASCRIPTCORE_KEY4 (94), __PTK_FRAMEWORK_GC_KEY9 (112) and __PTK_FRAMEWORK_OLDGC_KEY9 (89)
|
// other possible unused ones are 9, 29, __PTK_FRAMEWORK_JAVASCRIPTCORE_KEY4 (94), __PTK_FRAMEWORK_GC_KEY9 (112) and __PTK_FRAMEWORK_OLDGC_KEY9 (89)
|
||||||
// see <https://github.com/rweichler/substrate/blob/master/include/pthread_machdep.h>
|
// see <https://github.com/rweichler/substrate/blob/master/include/pthread_machdep.h>
|
||||||
|
@ -823,7 +831,7 @@ static inline void* mi_tls_slot(size_t slot) mi_attr_noexcept {
|
||||||
const size_t ofs = (slot*sizeof(void*));
|
const size_t ofs = (slot*sizeof(void*));
|
||||||
#if defined(__i386__)
|
#if defined(__i386__)
|
||||||
__asm__("movl %%gs:%1, %0" : "=r" (res) : "m" (*((void**)ofs)) : ); // 32-bit always uses GS
|
__asm__("movl %%gs:%1, %0" : "=r" (res) : "m" (*((void**)ofs)) : ); // 32-bit always uses GS
|
||||||
#elif defined(__MACH__) && defined(__x86_64__)
|
#elif defined(__APPLE__) && defined(__x86_64__)
|
||||||
__asm__("movq %%gs:%1, %0" : "=r" (res) : "m" (*((void**)ofs)) : ); // x86_64 macOSX uses GS
|
__asm__("movq %%gs:%1, %0" : "=r" (res) : "m" (*((void**)ofs)) : ); // x86_64 macOSX uses GS
|
||||||
#elif defined(__x86_64__) && (MI_INTPTR_SIZE==4)
|
#elif defined(__x86_64__) && (MI_INTPTR_SIZE==4)
|
||||||
__asm__("movl %%fs:%1, %0" : "=r" (res) : "m" (*((void**)ofs)) : ); // x32 ABI
|
__asm__("movl %%fs:%1, %0" : "=r" (res) : "m" (*((void**)ofs)) : ); // x32 ABI
|
||||||
|
@ -850,7 +858,7 @@ static inline void mi_tls_slot_set(size_t slot, void* value) mi_attr_noexcept {
|
||||||
const size_t ofs = (slot*sizeof(void*));
|
const size_t ofs = (slot*sizeof(void*));
|
||||||
#if defined(__i386__)
|
#if defined(__i386__)
|
||||||
__asm__("movl %1,%%gs:%0" : "=m" (*((void**)ofs)) : "rn" (value) : ); // 32-bit always uses GS
|
__asm__("movl %1,%%gs:%0" : "=m" (*((void**)ofs)) : "rn" (value) : ); // 32-bit always uses GS
|
||||||
#elif defined(__MACH__) && defined(__x86_64__)
|
#elif defined(__APPLE__) && defined(__x86_64__)
|
||||||
__asm__("movq %1,%%gs:%0" : "=m" (*((void**)ofs)) : "rn" (value) : ); // x86_64 macOSX uses GS
|
__asm__("movq %1,%%gs:%0" : "=m" (*((void**)ofs)) : "rn" (value) : ); // x86_64 macOSX uses GS
|
||||||
#elif defined(__x86_64__) && (MI_INTPTR_SIZE==4)
|
#elif defined(__x86_64__) && (MI_INTPTR_SIZE==4)
|
||||||
__asm__("movl %1,%%fs:%1" : "=m" (*((void**)ofs)) : "rn" (value) : ); // x32 ABI
|
__asm__("movl %1,%%fs:%1" : "=m" (*((void**)ofs)) : "rn" (value) : ); // x32 ABI
|
||||||
|
@ -875,6 +883,9 @@ static inline uintptr_t _mi_thread_id(void) mi_attr_noexcept {
|
||||||
#if defined(__aarch64__) && defined(__APPLE__) // M1
|
#if defined(__aarch64__) && defined(__APPLE__) // M1
|
||||||
// on macOS on the M1, slot 0 does not seem to work, so we fall back to portable C for now. See issue #354
|
// on macOS on the M1, slot 0 does not seem to work, so we fall back to portable C for now. See issue #354
|
||||||
return (uintptr_t)&_mi_heap_default;
|
return (uintptr_t)&_mi_heap_default;
|
||||||
|
#elif defined(__BIONIC__) && (defined(__arm__) || defined(__aarch64__))
|
||||||
|
// on Android, slot 1 is the thread ID (pointer to pthread internal struct)
|
||||||
|
return (uintptr_t)mi_tls_slot(1);
|
||||||
#else
|
#else
|
||||||
// in all our other targets, slot 0 is the pointer to the thread control block
|
// in all our other targets, slot 0 is the pointer to the thread control block
|
||||||
return (uintptr_t)mi_tls_slot(0);
|
return (uintptr_t)mi_tls_slot(0);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
Copyright (c) 2018,2019 Microsoft Research, Daan Leijen
|
Copyright (c) 2018-2020 Microsoft Research, Daan Leijen
|
||||||
This is free software; you can redistribute it and/or modify it under the
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the MIT license. A copy of the license can be found in the file
|
terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
Copyright (c) 2018,2019 Microsoft Research, Daan Leijen
|
Copyright (c) 2018-2020 Microsoft Research, Daan Leijen
|
||||||
This is free software; you can redistribute it and/or modify it under the
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the MIT license. A copy of the license can be found in the file
|
terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
Copyright (c) 2018, Microsoft Research, Daan Leijen
|
Copyright (c) 2018-2021, Microsoft Research, Daan Leijen
|
||||||
This is free software; you can redistribute it and/or modify it under the
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the MIT license. A copy of the license can be found in the file
|
terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
Copyright (c) 2018-2020, Microsoft Research, Daan Leijen
|
Copyright (c) 2018-2021, Microsoft Research, Daan Leijen
|
||||||
This is free software; you can redistribute it and/or modify it under the
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the MIT license. A copy of the license can be found in the file
|
terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
|
|
|
@ -12,8 +12,8 @@ is a general purpose allocator with excellent [performance](#performance) charac
|
||||||
Initially developed by Daan Leijen for the run-time systems of the
|
Initially developed by Daan Leijen for the run-time systems of the
|
||||||
[Koka](https://koka-lang.github.io) and [Lean](https://github.com/leanprover/lean) languages.
|
[Koka](https://koka-lang.github.io) and [Lean](https://github.com/leanprover/lean) languages.
|
||||||
|
|
||||||
Latest release tag: `v2.0.0` (beta, 2021-01-31).
|
Latest release tag: `v2.0.1` (beta, 2021-04-06).
|
||||||
Latest stable tag: `v1.7.0` (2021-01-31).
|
Latest stable tag: `v1.7.1` (2021-04-06).
|
||||||
|
|
||||||
mimalloc is a drop-in replacement for `malloc` and can be used in other programs
|
mimalloc is a drop-in replacement for `malloc` and can be used in other programs
|
||||||
without code changes, for example, on dynamically linked ELF-based systems (Linux, BSD, etc.) you can use it as:
|
without code changes, for example, on dynamically linked ELF-based systems (Linux, BSD, etc.) you can use it as:
|
||||||
|
@ -71,7 +71,9 @@ Enjoy!
|
||||||
* `dev`: development branch for mimalloc v1.
|
* `dev`: development branch for mimalloc v1.
|
||||||
* `dev-slice`: development branch for mimalloc v2 with a new algorithm for managing internal mimalloc pages.
|
* `dev-slice`: development branch for mimalloc v2 with a new algorithm for managing internal mimalloc pages.
|
||||||
|
|
||||||
### Release
|
### Releases
|
||||||
|
|
||||||
|
* 2021-04-06, `v1.7.1`, `v2.0.1` (beta): fix bug in arena allocation for huge pages, improved aslr on large allocations, improved M1 support (still experimental).
|
||||||
|
|
||||||
* 2021-01-31, `v2.0.0`: beta release 2.0: new algorithm for managing internal mimalloc pages that tends to use reduce memory usage
|
* 2021-01-31, `v2.0.0`: beta release 2.0: new algorithm for managing internal mimalloc pages that tends to use reduce memory usage
|
||||||
and fragmentation compared to mimalloc v1 (especially for large workloads). Should otherwise have similar performance
|
and fragmentation compared to mimalloc v1 (especially for large workloads). Should otherwise have similar performance
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
Copyright (c) 2018, Microsoft Research, Daan Leijen
|
Copyright (c) 2018-2021, Microsoft Research, Daan Leijen
|
||||||
This is free software; you can redistribute it and/or modify it under the
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the MIT license. A copy of the license can be found in the file
|
terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
Copyright (c) 2018, Microsoft Research, Daan Leijen
|
Copyright (c) 2018-2020, Microsoft Research, Daan Leijen
|
||||||
This is free software; you can redistribute it and/or modify it under the
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the MIT license. A copy of the license can be found in the file
|
terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
Copyright (c) 2018, Microsoft Research, Daan Leijen
|
Copyright (c) 2018-2021, Microsoft Research, Daan Leijen
|
||||||
This is free software; you can redistribute it and/or modify it under the
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the MIT license. A copy of the license can be found in the file
|
terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
|
@ -13,13 +13,13 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
#error "It is only possible to override "malloc" on Windows when building as a DLL (and linking the C runtime as a DLL)"
|
#error "It is only possible to override "malloc" on Windows when building as a DLL (and linking the C runtime as a DLL)"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MI_MALLOC_OVERRIDE) && !(defined(_WIN32)) // || (defined(__MACH__) && !defined(MI_INTERPOSE)))
|
#if defined(MI_MALLOC_OVERRIDE) && !(defined(_WIN32)) // || (defined(__APPLE__) && !defined(MI_INTERPOSE)))
|
||||||
|
|
||||||
// ------------------------------------------------------
|
// ------------------------------------------------------
|
||||||
// Override system malloc
|
// Override system malloc
|
||||||
// ------------------------------------------------------
|
// ------------------------------------------------------
|
||||||
|
|
||||||
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__MACH__)
|
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__APPLE__)
|
||||||
// use aliasing to alias the exported function to one of our `mi_` functions
|
// use aliasing to alias the exported function to one of our `mi_` functions
|
||||||
#if (defined(__GNUC__) && __GNUC__ >= 9)
|
#if (defined(__GNUC__) && __GNUC__ >= 9)
|
||||||
#define MI_FORWARD(fun) __attribute__((alias(#fun), used, visibility("default"), copy(fun)))
|
#define MI_FORWARD(fun) __attribute__((alias(#fun), used, visibility("default"), copy(fun)))
|
||||||
|
@ -81,7 +81,7 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
void free(void* p) MI_FORWARD0(mi_free, p);
|
void free(void* p) MI_FORWARD0(mi_free, p);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__MACH__)
|
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__APPLE__)
|
||||||
#pragma GCC visibility push(default)
|
#pragma GCC visibility push(default)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -187,11 +187,12 @@ void* memalign(size_t alignment, size_t size) { return mi_memali
|
||||||
int posix_memalign(void** p, size_t alignment, size_t size) { return mi_posix_memalign(p, alignment, size); }
|
int posix_memalign(void** p, size_t alignment, size_t size) { return mi_posix_memalign(p, alignment, size); }
|
||||||
void* _aligned_malloc(size_t alignment, size_t size) { return mi_aligned_alloc(alignment, size); }
|
void* _aligned_malloc(size_t alignment, size_t size) { return mi_aligned_alloc(alignment, size); }
|
||||||
|
|
||||||
// on some glibc `aligned_alloc` is declared `static inline` so we cannot override it (e.g. Conda). This happens
|
// `aligned_alloc` is only available when __USE_ISOC11 is defined.
|
||||||
// when _GLIBCXX_HAVE_ALIGNED_ALLOC is not defined. However, in those cases it will use `memalign`, `posix_memalign`,
|
// Note: Conda has a custom glibc where `aligned_alloc` is declared `static inline` and we cannot
|
||||||
// or `_aligned_malloc` and we can avoid overriding it ourselves.
|
// override it, but both _ISOC11_SOURCE and __USE_ISOC11 are undefined in Conda GCC7 or GCC9.
|
||||||
// We should always override if using C compilation. (issue #276)
|
// Fortunately, in the case where `aligned_alloc` is declared as `static inline` it
|
||||||
#if _GLIBCXX_HAVE_ALIGNED_ALLOC || !defined(__cplusplus)
|
// uses internally `memalign`, `posix_memalign`, or `_aligned_malloc` so we can avoid overriding it ourselves.
|
||||||
|
#if __USE_ISOC11
|
||||||
void* aligned_alloc(size_t alignment, size_t size) { return mi_aligned_alloc(alignment, size); }
|
void* aligned_alloc(size_t alignment, size_t size) { return mi_aligned_alloc(alignment, size); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -214,7 +215,7 @@ void* aligned_alloc(size_t alignment, size_t size) { return mi_aligned_alloc(a
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__MACH__)
|
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__APPLE__)
|
||||||
#pragma GCC visibility pop
|
#pragma GCC visibility pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
Copyright (c) 2018,2019, Microsoft Research, Daan Leijen
|
Copyright (c) 2018-2021, Microsoft Research, Daan Leijen
|
||||||
This is free software; you can redistribute it and/or modify it under the
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the MIT license. A copy of the license can be found in the file
|
terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
Copyright (c) 2018, Microsoft Research, Daan Leijen
|
Copyright (c) 2018-2021, Microsoft Research, Daan Leijen
|
||||||
This is free software; you can redistribute it and/or modify it under the
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the MIT license. A copy of the license can be found in the file
|
terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
Copyright (c) 2019, 2020, Microsoft Research, Daan Leijen
|
Copyright (c) 2019-2021, Microsoft Research, Daan Leijen
|
||||||
This is free software; you can redistribute it and/or modify it under the
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the MIT license. A copy of the license can be found in the file
|
terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
Copyright (c) 2019,2020 Microsoft Research, Daan Leijen
|
Copyright (c) 2019-2021 Microsoft Research, Daan Leijen
|
||||||
This is free software; you can redistribute it and/or modify it under the
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the MIT license. A copy of the license can be found in the file
|
terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
Copyright (c) 2019,2020 Microsoft Research, Daan Leijen
|
Copyright (c) 2019-2020 Microsoft Research, Daan Leijen
|
||||||
This is free software; you can redistribute it and/or modify it under the
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the MIT license. A copy of the license can be found in the file
|
terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
Copyright (c) 2018, Microsoft Research, Daan Leijen
|
Copyright (c) 2018-2021, Microsoft Research, Daan Leijen
|
||||||
This is free software; you can redistribute it and/or modify it under the
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the MIT license. A copy of the license can be found in the file
|
terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
Copyright (c) 2018, Microsoft Research, Daan Leijen
|
Copyright (c) 2018-2021, Microsoft Research, Daan Leijen
|
||||||
This is free software; you can redistribute it and/or modify it under the
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the MIT license. A copy of the license can be found in the file
|
terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
Copyright (c) 2018, Microsoft Research, Daan Leijen
|
Copyright (c) 2018-2021, Microsoft Research, Daan Leijen
|
||||||
This is free software; you can redistribute it and/or modify it under the
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the MIT license. A copy of the license can be found in the file
|
terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
|
@ -262,7 +262,7 @@ static _Atomic(uintptr_t) warning_count; // = 0; // when >= max_warning_count s
|
||||||
static mi_decl_thread bool recurse = false;
|
static mi_decl_thread bool recurse = false;
|
||||||
|
|
||||||
static bool mi_recurse_enter(void) {
|
static bool mi_recurse_enter(void) {
|
||||||
#if defined(__MACH__) || defined(MI_TLS_RECURSE_GUARD)
|
#if defined(__APPLE__) || defined(MI_TLS_RECURSE_GUARD)
|
||||||
if (_mi_preloading()) return true;
|
if (_mi_preloading()) return true;
|
||||||
#endif
|
#endif
|
||||||
if (recurse) return false;
|
if (recurse) return false;
|
||||||
|
@ -271,7 +271,7 @@ static bool mi_recurse_enter(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mi_recurse_exit(void) {
|
static void mi_recurse_exit(void) {
|
||||||
#if defined(__MACH__) || defined(MI_TLS_RECURSE_GUARD)
|
#if defined(__APPLE__) || defined(MI_TLS_RECURSE_GUARD)
|
||||||
if (_mi_preloading()) return;
|
if (_mi_preloading()) return;
|
||||||
#endif
|
#endif
|
||||||
recurse = false;
|
recurse = false;
|
||||||
|
|
2
src/os.c
2
src/os.c
|
@ -1,5 +1,5 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
Copyright (c) 2018, Microsoft Research, Daan Leijen
|
Copyright (c) 2018-2021, Microsoft Research, Daan Leijen
|
||||||
This is free software; you can redistribute it and/or modify it under the
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the MIT license. A copy of the license can be found in the file
|
terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
Copyright (c) 2018, Microsoft Research, Daan Leijen
|
Copyright (c) 2018-2020, Microsoft Research, Daan Leijen
|
||||||
This is free software; you can redistribute it and/or modify it under the
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the MIT license. A copy of the license can be found in the file
|
terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
Copyright (c) 2018, Microsoft Research, Daan Leijen
|
Copyright (c) 2018-2020, Microsoft Research, Daan Leijen
|
||||||
This is free software; you can redistribute it and/or modify it under the
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the MIT license. A copy of the license can be found in the file
|
terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
Copyright (c) 2019, Microsoft Research, Daan Leijen
|
Copyright (c) 2019-2021, Microsoft Research, Daan Leijen
|
||||||
This is free software; you can redistribute it and/or modify it under the
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the MIT license. A copy of the license can be found in the file
|
terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
Copyright (c) 2019, Microsoft Research, Daan Leijen
|
Copyright (c) 2019-2020, Microsoft Research, Daan Leijen
|
||||||
This is free software; you can redistribute it and/or modify it under the
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the MIT license. A copy of the license can be found in the file
|
terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
Copyright (c) 2018, Microsoft Research, Daan Leijen
|
Copyright (c) 2018-2020, Microsoft Research, Daan Leijen
|
||||||
This is free software; you can redistribute it and/or modify it under the
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the MIT license. A copy of the license can be found in the file
|
terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
Copyright (c) 2018, Microsoft Research, Daan Leijen
|
Copyright (c) 2018-2020, Microsoft Research, Daan Leijen
|
||||||
This is free software; you can redistribute it and/or modify it under the
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the MIT license. A copy of the license can be found in the file
|
terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
Copyright (c) 2018, Microsoft Research, Daan Leijen
|
Copyright (c) 2018-2021, Microsoft Research, Daan Leijen
|
||||||
This is free software; you can redistribute it and/or modify it under the
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the MIT license. A copy of the license can be found in the file
|
terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
|
@ -479,12 +479,12 @@ static void mi_stat_process_info(mi_msecs_t* elapsed, mi_msecs_t* utime, mi_msec
|
||||||
*page_faults = (size_t)info.PageFaultCount;
|
*page_faults = (size_t)info.PageFaultCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__)) || defined(__HAIKU__)
|
#elif defined(__unix__) || defined(__unix) || defined(unix) || defined(__APPLE__) || defined(__HAIKU__)
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
|
||||||
#if defined(__APPLE__) && defined(__MACH__)
|
#if defined(__APPLE__)
|
||||||
#include <mach/mach.h>
|
#include <mach/mach.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -520,7 +520,7 @@ static void mi_stat_process_info(mi_msecs_t* elapsed, mi_msecs_t* utime, mi_msec
|
||||||
while (get_next_area_info(tid.team, &c, &mem) == B_OK) {
|
while (get_next_area_info(tid.team, &c, &mem) == B_OK) {
|
||||||
*peak_rss += mem.ram_size;
|
*peak_rss += mem.ram_size;
|
||||||
}
|
}
|
||||||
#elif defined(__APPLE__) && defined(__MACH__)
|
#elif defined(__APPLE__)
|
||||||
*peak_rss = rusage.ru_maxrss; // BSD reports in bytes
|
*peak_rss = rusage.ru_maxrss; // BSD reports in bytes
|
||||||
struct mach_task_basic_info info;
|
struct mach_task_basic_info info;
|
||||||
mach_msg_type_number_t infoCount = MACH_TASK_BASIC_INFO_COUNT;
|
mach_msg_type_number_t infoCount = MACH_TASK_BASIC_INFO_COUNT;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
Copyright (c) 2018, Microsoft Research, Daan Leijen
|
Copyright (c) 2018-2020, Microsoft Research, Daan Leijen
|
||||||
This is free software; you can redistribute it and/or modify it under the
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the MIT license. A copy of the license can be found in the file
|
terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
Copyright (c) 2018,2019 Microsoft Research, Daan Leijen
|
Copyright (c) 2018-2020 Microsoft Research, Daan Leijen
|
||||||
This is free software; you can redistribute it and/or modify it under the
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
terms of the MIT license.
|
terms of the MIT license.
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue