Skip to content

Commit

Permalink
Use jemalloc as a default
Browse files Browse the repository at this point in the history
Summary:
Including the gitian builds. Minimum version is set to 3.6.0 which is
widely distributed (tested on Ubuntu 18.04).

Depends on D6365.

Test Plan:
Read the docs.
Run the gitian build twice on different machines and check the build is
deterministic.

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Subscribers: deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D6042
  • Loading branch information
Fabcien committed Jun 4, 2020
1 parent 62d103a commit 0f15392
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 7 deletions.
1 change: 1 addition & 0 deletions contrib/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Build-Depends: cmake (>= 3.13),
git,
libdb5.3++-dev,
libevent-dev,
libjemalloc-dev,
libminiupnpc-dev,
libboost-filesystem-dev,
libboost-chrono-dev,
Expand Down
3 changes: 2 additions & 1 deletion contrib/gitian-descriptors/gitian-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ script: |
-DBUILD_LIBBITCOINCONSENSUS=OFF \
-DENABLE_CLANG_TIDY=OFF \
-DENABLE_QRCODE=OFF \
-DENABLE_UPNP=OFF
-DENABLE_UPNP=OFF \
-DUSE_JEMALLOC=OFF
ninja package_source
SOURCEDIST=`echo bitcoin-abc-*.tar.gz`
Expand Down
4 changes: 3 additions & 1 deletion contrib/gitian-descriptors/gitian-osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ script: |
-DBUILD_LIBBITCOINCONSENSUS=OFF \
-DENABLE_CLANG_TIDY=OFF \
-DENABLE_QRCODE=OFF \
-DENABLE_UPNP=OFF
-DENABLE_UPNP=OFF \
-DUSE_JEMALLOC=OFF
ninja package_source
SOURCEDIST=`echo bitcoin-abc-*.tar.gz`
mv ${SOURCEDIST} ..
Expand Down
3 changes: 2 additions & 1 deletion contrib/gitian-descriptors/gitian-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ script: |
-DBUILD_LIBBITCOINCONSENSUS=OFF \
-DENABLE_CLANG_TIDY=OFF \
-DENABLE_QRCODE=OFF \
-DENABLE_UPNP=OFF
-DENABLE_UPNP=OFF \
-DUSE_JEMALLOC=OFF
ninja package_source
SOURCEDIST=`echo bitcoin-abc-*.tar.gz`
Expand Down
1 change: 1 addition & 0 deletions contrib/teamcity/setup-debian-buster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ PACKAGES=(
libdb++-dev
libdb-dev
libevent-dev
libjemalloc-dev
libminiupnpc-dev
libprotobuf-dev
libqrencode-dev
Expand Down
5 changes: 5 additions & 0 deletions doc/build-unix.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Optional dependencies:
------------|------------------|----------------------
miniupnpc | UPnP Support | Firewall-jumping support
libdb | Berkeley DB | Wallet storage (only needed when wallet enabled)
jemalloc | Memory allocator | Library to enhance the memory allocation and improve performances
qt | GUI | GUI toolkit (only needed when GUI enabled)
protobuf | Payments in GUI | Data interchange format used for payment protocol (only needed when BIP70 enabled)
libqrencode | QR codes in GUI | Optional for generating QR codes (only needed when GUI enabled)
Expand Down Expand Up @@ -108,6 +109,10 @@ ZMQ dependencies (provides ZMQ API, can be disabled by passing `-DBUILD_BITCOIN_

sudo apt-get install libzmq3-dev

jemalloc dependencies (provides the jemalloc library, can be disabled by passing `-DUSE_JEMALLOC=OFF` on the cmake command line):

sudo apt-get install libjemalloc-dev

Dependencies for the GUI: Ubuntu & Debian
-----------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion doc/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ These are the dependencies currently used by Bitcoin ABC. You can find instructi
| FreeType | [2.7.1](http://download.savannah.gnu.org/releases/freetype) | | No | | |
| GCC | | [5.0](https://gcc.gnu.org/) (C++14 support) | | | |
| HarfBuzz-NG | | | | | |
| jemalloc | [5.2.1](https://github.com/jemalloc/jemalloc/releases) | | | | |
| jemalloc | [5.2.1](https://github.com/jemalloc/jemalloc/releases) | 3.6.0 | | | |
| libevent | [2.1.11-stable](https://github.com/libevent/libevent/releases) | 2.0.22 | No | | |
| libpng | | | | | Yes |
| libsrvg | | | | | |
Expand Down
7 changes: 4 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ option(START_WITH_UPNP "Make UPnP the default to map ports" OFF)
option(ENABLE_CLANG_TIDY "Enable clang-tidy checks for Bitcoin ABC" OFF)
option(ENABLE_PROFILING "Select the profiling tool to use" OFF)
option(USE_LD_GOLD "Try to use gold as a linker if available" ON)
option(USE_JEMALLOC_EXPERIMENTAL "Use jemalloc as an allocation library (experimental)" OFF)
option(USE_JEMALLOC "Use jemalloc as an allocation library" ON)

if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(DEFAULT_ENABLE_DBUS_NOTIFICATIONS ON)
Expand All @@ -49,6 +49,7 @@ native_add_cmake_flags(
"-DBUILD_BITCOIN_ZMQ=OFF"
"-DENABLE_QRCODE=OFF"
"-DENABLE_UPNP=OFF"
"-DUSE_JEMALLOC=OFF"
# Forward the current setting for clang-tidy
"-DENABLE_CLANG_TIDY=${ENABLE_CLANG_TIDY}"
)
Expand Down Expand Up @@ -228,14 +229,14 @@ if(ENABLE_GLIBC_BACK_COMPAT)
endif()
endif()

if(USE_JEMALLOC_EXPERIMENTAL)
if(USE_JEMALLOC)
# Most of the sanitizers require their instrumented allocation functions to
# be fully functional. This is obviously the case for all the memory related
# sanitizers (asan, lsan, msan) but not only.
if(ENABLE_SANITIZERS)
message(WARNING "Jemalloc is incompatible with the sanitizers and has been disabled.")
else()
find_package(Jemalloc REQUIRED)
find_package(Jemalloc 3.6.0 REQUIRED)
link_libraries(Jemalloc::jemalloc)
endif()
endif()
Expand Down

0 comments on commit 0f15392

Please sign in to comment.