Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 9 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,15 @@ any of the following arguments (not a definitive list) to 'configure':
configuration, jemalloc will provide additional size classes that are not
16-byte-aligned (24, 40, and 56).

* `--disable-initial-exec-tls`

Disable the initial-exec TLS model for jemalloc's internal thread-local
storage (on those platforms that support explicit settings). This can allow
jemalloc to be dynamically loaded after program starup (e.g. using dlopen).
Note that in this case, there will be two malloc implementations operating
in the same process, which will almost certainly result in confusing runtime
crashes if pointers leak from one implementation to the other.

The following environment variables (not a definitive list) impact configure's
behavior:

Expand Down
32 changes: 26 additions & 6 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -733,12 +733,9 @@ JE_COMPILABLE([tls_model attribute], [],
foo = 0;],
[je_cv_tls_model])
JE_CFLAGS_RESTORE()
if test "x${je_cv_tls_model}" = "xyes" ; then
AC_DEFINE([JEMALLOC_TLS_MODEL],
[__attribute__((tls_model("initial-exec")))])
else
AC_DEFINE([JEMALLOC_TLS_MODEL], [ ])
fi
dnl (Setting of JEMALLOC_TLS_MODEL is done later, after we've checked for
dnl --disable-initial-exec-tls)

dnl Check for alloc_size attribute support.
JE_CFLAGS_SAVE()
JE_CFLAGS_ADD([-Werror])
Expand Down Expand Up @@ -1993,6 +1990,29 @@ if test "x${enable_zone_allocator}" = "x1" ; then
AC_DEFINE([JEMALLOC_ZONE], [ ])
fi

dnl ============================================================================
dnl Use initial-exec TLS by default.
AC_ARG_ENABLE([initial-exec-tls],
[AS_HELP_STRING([--disable-initial-exec-tls],
[Disable the initial-exec tls model])],
[if test "x$enable_initial_exec_tls" = "xno" ; then
enable_initial_exec_tls="0"
else
enable_initial_exec_tls="1"
fi
],
[enable_initial_exec_tls="1"]
)
AC_SUBST([enable_initial_exec_tls])

if test "x${je_cv_tls_model}" = "xyes" -a \
"x${enable_initial_exec_tls}" = "x1" ; then
AC_DEFINE([JEMALLOC_TLS_MODEL],
[__attribute__((tls_model("initial-exec")))])
else
AC_DEFINE([JEMALLOC_TLS_MODEL], [ ])
fi

dnl ============================================================================
dnl Enable background threads if possible.

Expand Down