mimalloc icon indicating copy to clipboard operation
mimalloc copied to clipboard

Mimalloc attempts to allocate 33 MB shortly after thread start, prints spurious warning when it fails

Open Jarred-Sumner opened this issue 2 years ago • 0 comments

On start when several threads are spawned, the following warning message is printed when using the debug build of mimalloc:

_mi_warning_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);

This warning message is not always actionable because (in this case) the developer didn't ask to allocate 33 MB. In my case, I care because it causes tests which read from stdout/stderr to fail.

Stepping through in a debugger, we can see the requested size is 64 bytes:

image

This is the stack trace:

image

When it reaches the warning, size & alignment seem to be 33,554,432:

image

Should this warning be silenced? Or does it point to a real problem and if so, what kinds of action can be taken (reduce the stack size of the application?)

Jarred-Sumner avatar Nov 10 '23 10:11 Jarred-Sumner