Skip to content
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

gh-112536: Define MI_TSAN to 1 for --with-mimalloc and --with-thread-sanitizer #116558

Merged
merged 5 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 8 additions & 0 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -4750,6 +4750,12 @@ elif test "$disable_gil" = "yes"; then
AC_MSG_ERROR([--disable-gil requires mimalloc memory allocator (--with-mimalloc).])
fi

if test "$with_mimalloc" = yes; then
if test "$with_tsan" = yes; then
AC_DEFINE([MI_TSAN], [1], [Define MI_TSAN for mimalloc thread sanitizer support])
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should do this in pycore_mimalloc.h instead. We already do that for MI_DEBUG and some other defines.

Something like:

#ifdef _Py_THREAD_SANITIZER
#  define MI_TSAN 1
#endif

Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, yes that looks like a better solution.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done :)

fi
fi

AC_MSG_RESULT([$with_mimalloc])
AC_SUBST([WITH_MIMALLOC])
AC_SUBST([MIMALLOC_HEADERS])
Expand Down
3 changes: 3 additions & 0 deletions pyconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -1588,6 +1588,9 @@
<sysmacros.h>. */
#undef MAJOR_IN_SYSMACROS

/* Define MI_TSAN for mimalloc thread sanitizer support */
#undef MI_TSAN

/* Define if mvwdelch in curses.h is an expression. */
#undef MVWDELCH_IS_EXPRESSION

Expand Down
Loading