cpython/Objects/mimalloc/prim/windows
Dino Viehland 05f2f0ac92
gh-90815: Add mimalloc memory allocator (#109914)
* Add mimalloc v2.12

Modified src/alloc.c to remove include of alloc-override.c and not
compile new handler.

Did not include the following files:

 - include/mimalloc-new-delete.h
 - include/mimalloc-override.h
 - src/alloc-override-osx.c
 - src/alloc-override.c
 - src/static.c
 - src/region.c

mimalloc is thread safe and shares a single heap across all runtimes,
therefore finalization and getting global allocated blocks across all
runtimes is different.

* mimalloc: minimal changes for use in Python:

 - remove debug spam for freeing large allocations
 - use same bytes (0xDD) for freed allocations in CPython and mimalloc
   This is important for the test_capi debug memory tests

* Don't export mimalloc symbol in libpython.
* Enable mimalloc as Python allocator option.
* Add mimalloc MIT license.
* Log mimalloc in Lib/test/pythoninfo.py.
* Document new mimalloc support.
* Use macro defs for exports as done in:
  https://github.com/python/cpython/pull/31164/

Co-authored-by: Sam Gross <colesbury@gmail.com>
Co-authored-by: Christian Heimes <christian@python.org>
Co-authored-by: Victor Stinner <vstinner@python.org>
2023-10-30 15:43:11 +00:00
..
etw-mimalloc.wprp gh-90815: Add mimalloc memory allocator (#109914) 2023-10-30 15:43:11 +00:00
etw.h gh-90815: Add mimalloc memory allocator (#109914) 2023-10-30 15:43:11 +00:00
etw.man gh-90815: Add mimalloc memory allocator (#109914) 2023-10-30 15:43:11 +00:00
prim.c gh-90815: Add mimalloc memory allocator (#109914) 2023-10-30 15:43:11 +00:00
readme.md gh-90815: Add mimalloc memory allocator (#109914) 2023-10-30 15:43:11 +00:00

readme.md

Primitives:

  • prim.c contains Windows primitives for OS allocation.

Event Tracing for Windows (ETW)

  • etw.h is generated from etw.man which contains the manifest for mimalloc events. (100 is an allocation, 101 is for a free)

  • etw-mimalloc.wprp is a profile for the Windows Performance Recorder (WPR). In an admin prompt, you can use:

    > wpr -start src\prim\windows\etw-mimalloc.wprp -filemode
    > <my mimalloc program>
    > wpr -stop test.etl
    

    and then open test.etl in the Windows Performance Analyzer (WPA).