mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-07 15:59:32 +03:00
Merge branch 'dev' into dev-slice
This commit is contained in:
commit
a4e7ff8608
3 changed files with 22 additions and 21 deletions
|
@ -219,7 +219,6 @@ extern "C" {
|
||||||
// Forward Posix/Unix calls as well
|
// Forward Posix/Unix calls as well
|
||||||
void* reallocf(void* p, size_t newsize) MI_FORWARD2(mi_reallocf,p,newsize)
|
void* reallocf(void* p, size_t newsize) MI_FORWARD2(mi_reallocf,p,newsize)
|
||||||
size_t malloc_size(const void* p) MI_FORWARD1(mi_usable_size,p)
|
size_t malloc_size(const void* p) MI_FORWARD1(mi_usable_size,p)
|
||||||
size_t malloc_good_size(size_t size) MI_FORWARD1(mi_malloc_good_size,size)
|
|
||||||
#if !defined(__ANDROID__) && !defined(__FreeBSD__)
|
#if !defined(__ANDROID__) && !defined(__FreeBSD__)
|
||||||
size_t malloc_usable_size(void *p) MI_FORWARD1(mi_usable_size,p)
|
size_t malloc_usable_size(void *p) MI_FORWARD1(mi_usable_size,p)
|
||||||
#else
|
#else
|
||||||
|
@ -229,8 +228,10 @@ extern "C" {
|
||||||
// No forwarding here due to aliasing/name mangling issues
|
// No forwarding here due to aliasing/name mangling issues
|
||||||
void* valloc(size_t size) { return mi_valloc(size); }
|
void* valloc(size_t size) { return mi_valloc(size); }
|
||||||
void vfree(void* p) { mi_free(p); }
|
void vfree(void* p) { mi_free(p); }
|
||||||
|
size_t malloc_good_size(size_t size) { return mi_malloc_good_size(size); }
|
||||||
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); }
|
||||||
|
|
||||||
|
|
||||||
// `aligned_alloc` is only available when __USE_ISOC11 is defined.
|
// `aligned_alloc` is only available when __USE_ISOC11 is defined.
|
||||||
// Note: Conda has a custom glibc where `aligned_alloc` is declared `static inline` and we cannot
|
// Note: Conda has a custom glibc where `aligned_alloc` is declared `static inline` and we cannot
|
||||||
// override it, but both _ISOC11_SOURCE and __USE_ISOC11 are undefined in Conda GCC7 or GCC9.
|
// override it, but both _ISOC11_SOURCE and __USE_ISOC11 are undefined in Conda GCC7 or GCC9.
|
||||||
|
|
6
src/os.c
6
src/os.c
|
@ -856,7 +856,7 @@ static bool mi_os_commitx(void* addr, size_t size, bool commit, bool conservativ
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
_mi_warning_message("%s error: start: %p, csize: 0x%x, err: %i\n", commit ? "commit" : "decommit", start, csize, err);
|
_mi_warning_message("%s error: start: %p, csize: 0x%zx, err: %i\n", commit ? "commit" : "decommit", start, csize, err);
|
||||||
mi_mprotect_hint(err);
|
mi_mprotect_hint(err);
|
||||||
}
|
}
|
||||||
mi_assert_internal(err == 0);
|
mi_assert_internal(err == 0);
|
||||||
|
@ -926,7 +926,7 @@ static bool mi_os_resetx(void* addr, size_t size, bool reset, mi_stats_t* stats)
|
||||||
int err = madvise(start, csize, MADV_DONTNEED);
|
int err = madvise(start, csize, MADV_DONTNEED);
|
||||||
#endif
|
#endif
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
_mi_warning_message("madvise reset error: start: %p, csize: 0x%x, errno: %i\n", start, csize, errno);
|
_mi_warning_message("madvise reset error: start: %p, csize: 0x%zx, errno: %i\n", start, csize, errno);
|
||||||
}
|
}
|
||||||
//mi_assert(err == 0);
|
//mi_assert(err == 0);
|
||||||
if (err != 0) return false;
|
if (err != 0) return false;
|
||||||
|
@ -985,7 +985,7 @@ static bool mi_os_protectx(void* addr, size_t size, bool protect) {
|
||||||
if (err != 0) { err = errno; }
|
if (err != 0) { err = errno; }
|
||||||
#endif
|
#endif
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
_mi_warning_message("mprotect error: start: %p, csize: 0x%x, err: %i\n", start, csize, err);
|
_mi_warning_message("mprotect error: start: %p, csize: 0x%zx, err: %i\n", start, csize, err);
|
||||||
mi_mprotect_hint(err);
|
mi_mprotect_hint(err);
|
||||||
}
|
}
|
||||||
return (err == 0);
|
return (err == 0);
|
||||||
|
|
|
@ -327,7 +327,7 @@ static void _mi_stats_print(mi_stats_t* stats, mi_output_fun* out0, void* arg0)
|
||||||
mi_stat_counter_print(&stats->commit_calls, "commits", out, arg);
|
mi_stat_counter_print(&stats->commit_calls, "commits", out, arg);
|
||||||
mi_stat_print(&stats->threads, "threads", -1, out, arg);
|
mi_stat_print(&stats->threads, "threads", -1, out, arg);
|
||||||
mi_stat_counter_print_avg(&stats->searches, "searches", out, arg);
|
mi_stat_counter_print_avg(&stats->searches, "searches", out, arg);
|
||||||
_mi_fprintf(out, arg, "%10s: %7i\n", "numa nodes", _mi_os_numa_node_count());
|
_mi_fprintf(out, arg, "%10s: %7zu\n", "numa nodes", _mi_os_numa_node_count());
|
||||||
|
|
||||||
mi_msecs_t elapsed;
|
mi_msecs_t elapsed;
|
||||||
mi_msecs_t user_time;
|
mi_msecs_t user_time;
|
||||||
|
|
Loading…
Add table
Reference in a new issue