Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gh-90815: Add mimalloc memory allocator #31164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Move mimalloc headers into internal header directory
  • Loading branch information
tiran committed Aug 30, 2022
commit 95d904ab57552a88b51e955ca853c7f6b73b8a19
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ Tools/ssl/win32
Tools/freeze/test/outdir

# unused mimalloc files
Include/mimalloc/mimalloc-new-delete.h
Include/mimalloc/mimalloc-override.h
Include/internal/mimalloc/mimalloc-new-delete.h
Include/internal/mimalloc/mimalloc-override.h

# The frozen modules are always generated by the build so we don't
# keep them in the repo. Also see Tools/scripts/freeze_modules.py.
Expand Down
File renamed without changes.
17 changes: 11 additions & 6 deletions Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,10 @@ IO_OBJS= \

MIMALLOC_HEADERS = \
$(srcdir)/Include/internal/pycore_mimalloc.h \
$(srcdir)/Include/mimalloc/mimalloc-atomic.h \
$(srcdir)/Include/mimalloc/mimalloc.h \
$(srcdir)/Include/mimalloc/mimalloc-internal.h \
$(srcdir)/Include/mimalloc/mimalloc-types.h \
$(srcdir)/Include/internal/mimalloc/mimalloc-atomic.h \
$(srcdir)/Include/internal/mimalloc/mimalloc.h \
$(srcdir)/Include/internal/mimalloc/mimalloc-internal.h \
$(srcdir)/Include/internal/mimalloc/mimalloc-types.h \

MIMALLOC_INCLUDES = \
$(srcdir)/Objects/mimalloc/alloc-aligned.c \
Expand Down Expand Up @@ -1310,7 +1310,7 @@ Python/dynload_hpux.o: $(srcdir)/Python/dynload_hpux.c Makefile

Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile $(srcdir)/Include/pydtrace.h @MIMALLOC_INCLUDES@
$(CC) -c $(PY_CORE_CFLAGS) \
-I$(srcdir)/Include/mimalloc \
-I$(srcdir)/Include/internal/mimalloc \
-DABIFLAGS='"$(ABIFLAGS)"' \
$(MULTIARCH_CPPFLAGS) \
-o $@ $(srcdir)/Python/sysmodule.c
Expand Down Expand Up @@ -2242,6 +2242,11 @@ inclinstall:
echo $(INSTALL_DATA) $$i $(INCLUDEPY)/internal; \
$(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY)/internal; \
done
@for i in $(srcdir)/Include/internal/mimalloc/*.h; \
do \
echo $(INSTALL_DATA) $$i $(INCLUDEPY)/internal/mimalloc; \
$(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY)/internal/mimalloc; \
done
$(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h

# Install the library and miscellaneous stuff needed for extending/embedding
Expand Down Expand Up @@ -2406,7 +2411,7 @@ Python/dtoa.o: Python/dtoa.c

# obmalloc includes mimalloc
Objects/obmalloc.o: Objects/obmalloc.c @MIMALLOC_INCLUDES@
$(CC) -c $(PY_CORE_CFLAGS) -I$(srcdir)/Include/mimalloc -o $@ $<
$(CC) -c $(PY_CORE_CFLAGS) -I$(srcdir)/Include/internal/mimalloc -o $@ $<

# Run reindent on the library
reindent:
Expand Down
2 changes: 1 addition & 1 deletion PCbuild/pyproject.props
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(PySourcePath)Include;$(PySourcePath)Include\internal;$(PySourcePath)Include\mimalloc;$(PySourcePath)PC;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(PySourcePath)Include;$(PySourcePath)Include\internal;$(PySourcePath)Include\internal\mimalloc;$(PySourcePath)PC;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;$(_Py3NamePreprocessorDefinition);$(_PlatformPreprocessorDefinition)$(_DebugPreprocessorDefinition)$(_PydPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>

<Optimization>MaxSpeed</Optimization>
Expand Down
12 changes: 8 additions & 4 deletions PCbuild/pythoncore.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@
<ClInclude Include="..\Include\cpython\longintrepr.h" />
<ClInclude Include="..\Include\cpython\longobject.h" />
<ClInclude Include="..\Include\cpython\methodobject.h" />
<ClInclude Include="..\Include\mimalloc\mimalloc-atomic.h" />
<ClInclude Include="..\Include\mimalloc\mimalloc.h" />
<ClInclude Include="..\Include\mimalloc\mimalloc-internal.h" />
<ClInclude Include="..\Include\mimalloc\mimalloc-types.h" />
<ClInclude Include="..\Include\internal\mimalloc\mimalloc-atomic.h" />
<ClInclude Include="..\Include\internal\mimalloc\mimalloc.h" />
<ClInclude Include="..\Include\internal\mimalloc\mimalloc-internal.h" />
<ClInclude Include="..\Include\internal\mimalloc\mimalloc-types.h" />
<ClInclude Include="..\Include\cpython\modsupport.h" />
<ClInclude Include="..\Include\cpython\object.h" />
<ClInclude Include="..\Include\cpython\objimpl.h" />
Expand Down Expand Up @@ -196,6 +196,10 @@
<ClInclude Include="..\Include\floatobject.h" />
<ClInclude Include="..\Include\frameobject.h" />
<ClInclude Include="..\Include\import.h" />
<ClInclude Include="..\Include\internal\mimalloc\mimalloc-atomic.h" />
<ClInclude Include="..\Include\internal\mimalloc\mimalloc.h" />
<ClInclude Include="..\Include\internal\mimalloc\mimalloc-internal.h" />
<ClInclude Include="..\Include\internal\mimalloc\mimalloc-types.h" />
<ClInclude Include="..\Include\internal\pycore_abstract.h" />
<ClInclude Include="..\Include\internal\pycore_asdl.h" />
<ClInclude Include="..\Include\internal\pycore_ast.h" />
Expand Down