Skip to content

Commit

Permalink
Remove jemalloc from the runtime
Browse files Browse the repository at this point in the history
As discovered in #9925, it turns out that we weren't using jemalloc on most
platforms. Additionally, on some platforms we were using it incorrectly and
mismatching the libc version of malloc with the jemalloc version of malloc.

Additionally, it's not clear that using jemalloc is indeed a large performance
win in particular situtations. This could be due to building jemalloc
incorrectly, or possibly due to using jemalloc incorrectly, but it is unclear at
this time.

Until jemalloc can be confirmed to integrate correctly on all platforms and has
verifiable large performance wins on platforms as well, it shouldn't be part of
the default build process. It should still be available for use via the
LD_PRELOAD trick on various architectures, but using it as the default allocator
for everything would require guaranteeing that it works in all situtations,
which it currently doesn't.

Closes #9925
  • Loading branch information
alexcrichton committed Oct 18, 2013
1 parent a1848bc commit 90911d7
Show file tree
Hide file tree
Showing 102 changed files with 2 additions and 44,521 deletions.
1 change: 0 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,6 @@ do
make_dir $t/rt/libuv/src/ares
make_dir $t/rt/libuv/src/eio
make_dir $t/rt/libuv/src/ev
make_dir $t/rt/jemalloc
for i in \
isaac sync test \
arch/i386 arch/x86_64 arch/arm arch/mips \
Expand Down
19 changes: 2 additions & 17 deletions mk/rt.mk
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ $$(RT_BUILD_DIR_$(1)_$(2))/arch/$$(HOST_$(1))/libmorestack.a: $$(MORESTACK_OBJ_$
$$(Q)$(AR_$(1)) rcs $$@ $$<

$$(RT_BUILD_DIR_$(1)_$(2))/$(CFG_RUNTIME_$(1)): $$(RUNTIME_OBJS_$(1)_$(2)) $$(MKFILE_DEPS) \
$$(RUNTIME_DEF_$(1)_$(2)) $$(LIBUV_LIB_$(1)) $$(JEMALLOC_LIB_$(1))
$$(RUNTIME_DEF_$(1)_$(2)) $$(LIBUV_LIB_$(1))
@$$(call E, link: $$@)
$$(Q)$$(call CFG_LINK_CXX_$(1),$$@, $$(RUNTIME_OBJS_$(1)_$(2)) \
$$(JEMALLOC_LIB_$(1)) $$(CFG_GCCISH_POST_LIB_FLAGS_$(1)) $$(LIBUV_LIB_$(1)) \
$$(LIBUV_LIB_$(1)) \
$$(CFG_LIBUV_LINK_FLAGS_$(1)),$$(RUNTIME_DEF_$(1)_$(2)),$$(CFG_RUNTIME_$(1)))

# These could go in rt.mk or rustllvm.mk, they're needed for both.
Expand Down Expand Up @@ -197,27 +197,22 @@ define DEF_THIRD_PARTY_TARGETS
# $(1) is the target triple

RT_OUTPUT_DIR_$(1) := $(1)/rt
JEMALLOC_TARGET_$(1) := jemalloc_pic

ifeq ($$(CFG_WINDOWSY_$(1)), 1)
LIBUV_OSTYPE_$(1) := win
JEMALLOC_TARGET_$(1) := jemalloc
else ifeq ($(OSTYPE_$(1)), apple-darwin)
LIBUV_OSTYPE_$(1) := mac
else ifeq ($(OSTYPE_$(1)), unknown-freebsd)
LIBUV_OSTYPE_$(1) := freebsd
else ifeq ($(OSTYPE_$(1)), linux-androideabi)
LIBUV_OSTYPE_$(1) := android
JEMALLOC_ARGS_$(1) := --disable-tls
LIBUV_ARGS_$(1) := PLATFORM=android host=android OS=linux
else
LIBUV_OSTYPE_$(1) := linux
endif

LIBUV_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),uv)
LIBUV_LIB_$(1) := $$(RT_OUTPUT_DIR_$(1))/libuv/$$(LIBUV_NAME_$(1))
JEMALLOC_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),$$(JEMALLOC_TARGET_$(1)))
JEMALLOC_LIB_$(1) := $$(RT_OUTPUT_DIR_$(1))/jemalloc/lib/$$(JEMALLOC_NAME_$(1))

LIBUV_MAKEFILE_$(1) := $$(CFG_BUILD_DIR)$$(RT_OUTPUT_DIR_$(1))/libuv/Makefile

Expand Down Expand Up @@ -253,16 +248,6 @@ $$(LIBUV_LIB_$(1)): $$(LIBUV_DEPS) $$(LIBUV_MAKEFILE_$(1))
V=$$(VERBOSE)
endif

$$(JEMALLOC_LIB_$(1)):
cd $$(RT_OUTPUT_DIR_$(1))/jemalloc; $(S)src/rt/jemalloc/configure \
$$(JEMALLOC_ARGS_$(1)) \
--disable-experimental --build=$(CFG_BUILD_TRIPLE) --host=$(1) \
EXTRA_CFLAGS="$$(CFG_GCCISH_CFLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1)))" \
CC="$$(CC_$(1))" \
CXX="$$(CXX_$(1))" \
AR="$$(AR_$(1))"
$$(Q)$$(MAKE) -C $$(RT_OUTPUT_DIR_$(1))/jemalloc build_lib_static

endef

# Instantiate template for all stages/targets
Expand Down
1 change: 0 additions & 1 deletion mk/tests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ tidy:
| grep '^$(S)src/libuv' -v \
| grep '^$(S)src/gyp' -v \
| grep '^$(S)src/etc' -v \
| grep '^$(S)src/rt/jemalloc' -v \
| xargs $(CFG_PYTHON) $(S)src/etc/check-binaries.py

endif
Expand Down
27 changes: 0 additions & 27 deletions src/rt/jemalloc/COPYING

This file was deleted.

Loading

5 comments on commit 90911d7

@bors
Copy link
Contributor

@bors bors commented on 90911d7 Oct 18, 2013

Choose a reason for hiding this comment

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

saw approval from brson
at alexcrichton@90911d7

@bors
Copy link
Contributor

@bors bors commented on 90911d7 Oct 18, 2013

Choose a reason for hiding this comment

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

merging alexcrichton/rust/no-jemalloc = 90911d7 into auto

@bors
Copy link
Contributor

@bors bors commented on 90911d7 Oct 18, 2013

Choose a reason for hiding this comment

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

alexcrichton/rust/no-jemalloc = 90911d7 merged ok, testing candidate = df187a0

@bors
Copy link
Contributor

@bors bors commented on 90911d7 Oct 18, 2013

@bors
Copy link
Contributor

@bors bors commented on 90911d7 Oct 18, 2013

Choose a reason for hiding this comment

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

fast-forwarding master to auto = df187a0

Please sign in to comment.