Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions Doc/whatsnew/3.16.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1295,11 +1295,6 @@ Build changes

(Contributed by Stan Ulbrych, Florian Mayer and AnnaAr321 in :gh:`156049`.)

* Update the bundled `mimalloc library`_ from version 2.1.2 to 2.5.2.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to remove this entry, remove this entry since we are going to target v3 cc @DinoV

(Contributed by Donghee Na in :gh:`159111`.)

.. _mimalloc library: https://github.com/microsoft/mimalloc/


C API changes
=============
Expand Down
2 changes: 2 additions & 0 deletions Include/internal/mimalloc/mimalloc/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ terms of the MIT license. A copy of the license can be found in the file
#define mi_decl_externc
#endif

// CPython: upstream defines __wasi__ on Emscripten here. It is removed so that
// CPython code can distinguish the two platforms (gh-158628).

// --------------------------------------------------------------------------
// Internal functions
Expand Down
1 change: 1 addition & 0 deletions Objects/mimalloc/os.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ static void* mi_os_prim_alloc_aligned(size_t size, size_t alignment, bool commit
else {
// if not aligned, free it, overallocate, and unmap around it
#if !MI_TRACK_ASAN
// CPython: downgraded from _mi_warning_message, the warning is noisy in the test suite (gh-112027)
_mi_verbose_message("unable to allocate aligned OS memory directly, fall back to over-allocation (size: 0x%zx bytes, address: %p, alignment: 0x%zx, commit: %d)\n", size, p, alignment, commit);
#endif
if (p != NULL) { mi_os_prim_free(p, size, (commit ? size : 0)); }
Expand Down
3 changes: 2 additions & 1 deletion Objects/mimalloc/prim/unix/prim.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ static bool unix_detect_overcommit(void) {
#if defined(__linux__)
int fd = mi_prim_open("/proc/sys/vm/overcommit_memory", O_RDONLY);
if (fd >= 0) {
char buf[32] = {0};
char buf[32] = {0}; // CPython: zero-initialize to avoid an MSAN report
ssize_t nread = mi_prim_read(fd, &buf, sizeof(buf));
mi_prim_close(fd);
// <https://www.kernel.org/doc/Documentation/vm/overcommit-accounting>
Expand Down Expand Up @@ -871,6 +871,7 @@ bool _mi_prim_random_buf(void* buf, size_t buf_len) {
#elif defined(__ANDROID__) || defined(__DragonFly__) || \
defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
defined(__sun) || \
defined(__CYGWIN__) /* CPython: gh-148461 */ || \
(defined(__APPLE__) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7))

bool _mi_prim_random_buf(void* buf, size_t buf_len) {
Expand Down
2 changes: 1 addition & 1 deletion Objects/mimalloc/random.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ uintptr_t _mi_os_random_weak(uintptr_t extra_seed) {
}

static void mi_random_init_ex(mi_random_ctx_t* ctx, bool use_weak) {
uint8_t key[32] = {0};
uint8_t key[32] = {0}; // CPython: zero-initialize to avoid an MSAN report
if (use_weak || !_mi_prim_random_buf(key, sizeof(key))) {
// if we fail to get random data from the OS, we fall back to a
// weak random source based on the current time
Expand Down
Loading