1
0
mirror of https://github.com/python/cpython synced 2024-07-03 07:53:35 +00:00

gh-90815: Exclude mimalloc .c files from Windows build (#111532)

* Don't include mimalloc .c's in Windows build
* Fix warnings on Windows related to mimalloc
This commit is contained in:
Dino Viehland 2023-10-31 11:54:35 -07:00 committed by GitHub
parent 2445673983
commit c42347d025
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 121 deletions

View File

@ -2730,22 +2730,23 @@ static bool _collect_alloc_stats(
static void
py_mimalloc_print_stats(FILE *out)
{
fprintf(out, "Small block threshold = %ld, in %u size classes.\n",
fprintf(out, "Small block threshold = %zd, in %u size classes.\n",
MI_SMALL_OBJ_SIZE_MAX, MI_BIN_HUGE);
fprintf(out, "Medium block threshold = %ld\n",
fprintf(out, "Medium block threshold = %zd\n",
MI_MEDIUM_OBJ_SIZE_MAX);
fprintf(out, "Large object max size = %ld\n",
fprintf(out, "Large object max size = %zd\n",
MI_LARGE_OBJ_SIZE_MAX);
mi_heap_t *heap = mi_heap_get_default();
struct _alloc_stats stats = {};
struct _alloc_stats stats;
memset(&stats, 0, sizeof(stats));
mi_heap_visit_blocks(heap, false, &_collect_alloc_stats, &stats);
fprintf(out, " Allocated Blocks: %ld\n", stats.allocated_blocks);
fprintf(out, " Allocated Bytes: %ld\n", stats.allocated_bytes);
fprintf(out, " Allocated Bytes w/ Overhead: %ld\n", stats.allocated_with_overhead);
fprintf(out, " Bytes Reserved: %ld\n", stats.bytes_reserved);
fprintf(out, " Bytes Committed: %ld\n", stats.bytes_committed);
fprintf(out, " Allocated Blocks: %zd\n", stats.allocated_blocks);
fprintf(out, " Allocated Bytes: %zd\n", stats.allocated_bytes);
fprintf(out, " Allocated Bytes w/ Overhead: %zd\n", stats.allocated_with_overhead);
fprintf(out, " Bytes Reserved: %zd\n", stats.bytes_reserved);
fprintf(out, " Bytes Committed: %zd\n", stats.bytes_committed);
}
#endif

View File

@ -511,6 +511,9 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
/* Use Python's own small-block memory-allocator. */
#define WITH_PYMALLOC 1
/* Define if you want to compile in mimalloc memory allocator. */
#define WITH_MIMALLOC 1
/* Define if you want to compile in object freelists optimization */
#define WITH_FREELISTS 1

View File

@ -147,20 +147,6 @@
<ClCompile Include="..\Objects\longobject.c" />
<ClCompile Include="..\Objects\memoryobject.c" />
<ClCompile Include="..\Objects\methodobject.c" />
<ClCompile Include="..\Objects\mimalloc\alloc-aligned.c" />
<ClCompile Include="..\Objects\mimalloc\alloc.c" />
<ClCompile Include="..\Objects\mimalloc\arena.c" />
<ClCompile Include="..\Objects\mimalloc\bitmap.c" />
<ClCompile Include="..\Objects\mimalloc\heap.c" />
<ClCompile Include="..\Objects\mimalloc\init.c" />
<ClCompile Include="..\Objects\mimalloc\options.c" />
<ClCompile Include="..\Objects\mimalloc\os.c" />
<ClCompile Include="..\Objects\mimalloc\page.c" />
<ClCompile Include="..\Objects\mimalloc\prim\prim.c" />
<ClCompile Include="..\Objects\mimalloc\random.c" />
<ClCompile Include="..\Objects\mimalloc\segment.c" />
<ClCompile Include="..\Objects\mimalloc\segment-map.c" />
<ClCompile Include="..\Objects\mimalloc\stats.c" />
<ClCompile Include="..\Objects\moduleobject.c" />
<ClCompile Include="..\Objects\namespaceobject.c" />
<ClCompile Include="..\Objects\object.c" />

View File

@ -253,48 +253,6 @@
<ClCompile Include="..\Objects\methodobject.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Objects\mimalloc\alloc-aligned.c">
<Filter>Source Files</Filter>
</CLCompile>
<ClCompile Include="..\Objects\mimalloc\alloc.c">
<Filter>Source Files</Filter>
</CLCompile>
<ClCompile Include="..\Objects\mimalloc\arena.c">
<Filter>Source Files</Filter>
</CLCompile>
<ClCompile Include="..\Objects\mimalloc\bitmap.c">
<Filter>Source Files</Filter>
</CLCompile>
<ClCompile Include="..\Objects\mimalloc\heap.c">
<Filter>Source Files</Filter>
</CLCompile>
<ClCompile Include="..\Objects\mimalloc\init.c">
<Filter>Source Files</Filter>
</CLCompile>
<ClCompile Include="..\Objects\mimalloc\options.c">
<Filter>Source Files</Filter>
</CLCompile>
<ClCompile Include="..\Objects\mimalloc\os.c">
<Filter>Source Files</Filter>
</CLCompile>
<ClCompile Include="..\Objects\mimalloc\page.c">
<Filter>Source Files</Filter>
</CLCompile>
<ClCompile Include="..\Objects\mimalloc\prim\prim.c">
<Filter>Source Files</Filter>
</CLCompile>
<ClCompile Include="..\Objects\mimalloc\random.c">
<Filter>Source Files</Filter>
</CLCompile>
<ClCompile Include="..\Objects\mimalloc\segment.c">
<Filter>Source Files</Filter>
</CLCompile>
<ClCompile Include="..\Objects\mimalloc\segment-map.c">
<Filter>Source Files</Filter>
</CLCompile>
<ClCompile Include="..\Objects\mimalloc\stats.c">
<Filter>Source Files</Filter>
</CLCompile>
<ClCompile Include="..\Python\modsupport.c">
<Filter>Source Files</Filter>
</ClCompile>

View File

@ -498,20 +498,6 @@
<ClCompile Include="..\Objects\longobject.c" />
<ClCompile Include="..\Objects\memoryobject.c" />
<ClCompile Include="..\Objects\methodobject.c" />
<ClCompile Include="..\Objects\mimalloc\alloc-aligned.c" />
<ClCompile Include="..\Objects\mimalloc\alloc.c" />
<ClCompile Include="..\Objects\mimalloc\arena.c" />
<ClCompile Include="..\Objects\mimalloc\bitmap.c" />
<ClCompile Include="..\Objects\mimalloc\heap.c" />
<ClCompile Include="..\Objects\mimalloc\init.c" />
<ClCompile Include="..\Objects\mimalloc\options.c" />
<ClCompile Include="..\Objects\mimalloc\os.c" />
<ClCompile Include="..\Objects\mimalloc\page.c" />
<ClCompile Include="..\Objects\mimalloc\prim\prim.c" />
<ClCompile Include="..\Objects\mimalloc\random.c" />
<ClCompile Include="..\Objects\mimalloc\segment.c" />
<ClCompile Include="..\Objects\mimalloc\segment-map.c" />
<ClCompile Include="..\Objects\mimalloc\stats.c" />
<ClCompile Include="..\Objects\moduleobject.c" />
<ClCompile Include="..\Objects\namespaceobject.c" />
<ClCompile Include="..\Objects\object.c" />

View File

@ -1130,48 +1130,6 @@
<ClCompile Include="..\Objects\methodobject.c">
<Filter>Objects</Filter>
</ClCompile>
<ClCompile Include="..\Objects\mimalloc\alloc.c">
<Filter>Objects\mimalloc</Filter>
</ClCompile>
<ClCompile Include="..\Objects\mimalloc\alloc-aligned.c">
<Filter>Objects\mimalloc</Filter>
</ClCompile>
<ClCompile Include="..\Objects\mimalloc\arena.c">
<Filter>Objects\mimalloc</Filter>
</ClCompile>
<ClCompile Include="..\Objects\mimalloc\bitmap.c">
<Filter>Objects\mimalloc</Filter>
</ClCompile>
<ClCompile Include="..\Objects\mimalloc\heap.c">
<Filter>Objects\mimalloc</Filter>
</ClCompile>
<ClCompile Include="..\Objects\mimalloc\init.c">
<Filter>Objects\mimalloc</Filter>
</ClCompile>
<ClCompile Include="..\Objects\mimalloc\options.c">
<Filter>Objects\mimalloc</Filter>
</ClCompile>
<ClCompile Include="..\Objects\mimalloc\os.c">
<Filter>Objects\mimalloc</Filter>
</ClCompile>
<ClCompile Include="..\Objects\mimalloc\page.c">
<Filter>Objects\mimalloc</Filter>
</ClCompile>
<ClCompile Include="..\Objects\mimalloc\prim\prim.c">
<Filter>Objects\mimalloc</Filter>
</ClCompile>
<ClCompile Include="..\Objects\mimalloc\random.c">
<Filter>Objects\mimalloc</Filter>
</ClCompile>
<ClCompile Include="..\Objects\mimalloc\segment.c">
<Filter>Objects\mimalloc</Filter>
</ClCompile>
<ClCompile Include="..\Objects\mimalloc\segment-map.c">
<Filter>Objects\mimalloc</Filter>
</ClCompile>
<ClCompile Include="..\Objects\mimalloc\stats.c">
<Filter>Objects\mimalloc</Filter>
</ClCompile>
<ClCompile Include="..\Objects\moduleobject.c">
<Filter>Objects</Filter>
</ClCompile>