Skip to content

Commit 9929c24

Browse files
committed
std: Update jemalloc version
It's been awhile since we last updated jemalloc, and there's likely some bugs that have been fixed since the last version we're using, so let's try to update again.
1 parent d4ffaf6 commit 9929c24

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

mk/rt.mk

+18-5
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,25 @@ define DEF_THIRD_PARTY_TARGETS
128128

129129
# $(1) is the target triple
130130

131-
ifeq ($$(CFG_WINDOWSY_$(1)), 1)
132-
# This isn't necessarily a desired option, but it's harmless and works around
133-
# what appears to be a mingw-w64 bug.
131+
ifeq ($$(CFG_WINDOWSY_$(1)),1)
132+
# A bit of history here, this used to be --enable-lazy-lock added in #14006
133+
# which was filed with jemalloc in jemalloc/jemalloc#83 which was also
134+
# reported to MinGW: http://sourceforge.net/p/mingw-w64/bugs/395/
135+
#
136+
# When updating jemalloc to 4.0, however, it was found that binaries would
137+
# exit with the status code STATUS_RESOURCE_NOT_OWNED indicating that a thread
138+
# was unlocking a mutex it never locked. Disabling this "lazy lock" option
139+
# seems to fix the issue, but it was enabled by default for MinGW targets in
140+
# 13473c7 for jemalloc.
141+
#
142+
# As a result of all that, force disabling lazy lock on Windows, and after
143+
# reading some code it at least *appears* that the initialization of mutexes
144+
# is otherwise ok in jemalloc, so shouldn't cause problems hopefully...
134145
#
135-
# https://sourceforge.net/p/mingw-w64/bugs/395/
136-
JEMALLOC_ARGS_$(1) := --enable-lazy-lock
146+
# tl;dr: make windows behave like other platforms by disabling lazy locking,
147+
# but requires passing an option due to a historical default with
148+
# jemalloc.
149+
JEMALLOC_ARGS_$(1) := --disable-lazy-lock
137150
else ifeq ($(OSTYPE_$(1)), apple-ios)
138151
JEMALLOC_ARGS_$(1) := --disable-tls
139152
else ifeq ($(findstring android, $(OSTYPE_$(1))), android)

src/jemalloc

Submodule jemalloc updated 102 files

0 commit comments

Comments
 (0)