diff --git a/CMakeLists.txt b/CMakeLists.txt index 8272a1a469..0629403dfe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -456,22 +456,6 @@ if((CLANG_ASAN_UBSAN OR CLANG_MSAN OR CLANG_TSAN) AND NOT CMAKE_C_COMPILER_ID MA message(FATAL_ERROR "Sanitizers are only supported for Clang") endif() -if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD|FreeBSD|Windows") # see #5318 - message(STATUS "skipping jemalloc on this system: ${CMAKE_SYSTEM_NAME}") - option(ENABLE_JEMALLOC "enable jemalloc" OFF) -else() - option(ENABLE_JEMALLOC "enable jemalloc" ON) -endif() - -if(ENABLE_JEMALLOC) - if(CLANG_ASAN_UBSAN OR CLANG_MSAN OR CLANG_TSAN) - message(STATUS "Sanitizers enabled; disabling jemalloc") - else() - find_package(JeMalloc REQUIRED) - include_directories(SYSTEM ${JEMALLOC_INCLUDE_DIRS}) - endif() -endif() - if(ENABLE_LIBINTL) # LibIntl (not Intl) selects our FindLibIntl.cmake script. #8464 find_package(LibIntl REQUIRED) diff --git a/README.md b/README.md index 39d809002e..4adb14322c 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ To skip bundled (`third-party/*`) dependencies: 1. Install the dependencies using a package manager. ``` - sudo apt install gperf luajit luarocks libuv1-dev libluajit-5.1-dev libunibilium-dev libmsgpack-dev libtermkey-dev libvterm-dev libjemalloc-dev + sudo apt install gperf luajit luarocks libuv1-dev libluajit-5.1-dev libunibilium-dev libmsgpack-dev libtermkey-dev libvterm-dev sudo luarocks build mpack sudo luarocks build lpeg sudo luarocks build inspect diff --git a/cmake/FindJeMalloc.cmake b/cmake/FindJeMalloc.cmake deleted file mode 100644 index f139196a38..0000000000 --- a/cmake/FindJeMalloc.cmake +++ /dev/null @@ -1,50 +0,0 @@ -# - Try to find jemalloc -# Once done this will define -# JEMALLOC_FOUND - System has jemalloc -# JEMALLOC_INCLUDE_DIRS - The jemalloc include directories -# JEMALLOC_LIBRARIES - The libraries needed to use jemalloc - -if(NOT USE_BUNDLED_JEMALLOC) - find_package(PkgConfig) - if (PKG_CONFIG_FOUND) - pkg_check_modules(PC_JEMALLOC QUIET jemalloc) - endif() -else() - set(PC_JEMALLOC_INCLUDEDIR) - set(PC_JEMALLOC_INCLUDE_DIRS) - set(PC_JEMALLOC_LIBDIR) - set(PC_JEMALLOC_LIBRARY_DIRS) - set(LIMIT_SEARCH NO_DEFAULT_PATH) -endif() - -set(JEMALLOC_DEFINITIONS ${PC_JEMALLOC_CFLAGS_OTHER}) - -find_path(JEMALLOC_INCLUDE_DIR jemalloc/jemalloc.h - PATHS ${PC_JEMALLOC_INCLUDEDIR} ${PC_JEMALLOC_INCLUDE_DIRS} - ${LIMIT_SEARCH}) - -# If we're asked to use static linkage, add libjemalloc.a as a preferred library name. -if(JEMALLOC_USE_STATIC) - list(APPEND JEMALLOC_NAMES - "${CMAKE_STATIC_LIBRARY_PREFIX}jemalloc${CMAKE_STATIC_LIBRARY_SUFFIX}") -elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - list(INSERT JEMALLOC_NAMES 0 - "${CMAKE_STATIC_LIBRARY_PREFIX}jemalloc${CMAKE_STATIC_LIBRARY_SUFFIX}") -endif() - -list(APPEND JEMALLOC_NAMES jemalloc) - -find_library(JEMALLOC_LIBRARY NAMES ${JEMALLOC_NAMES} - HINTS ${PC_JEMALLOC_LIBDIR} ${PC_JEMALLOC_LIBRARY_DIRS} - ${LIMIT_SEARCH}) - -set(JEMALLOC_LIBRARIES ${JEMALLOC_LIBRARY}) -set(JEMALLOC_INCLUDE_DIRS ${JEMALLOC_INCLUDE_DIR}) - -include(FindPackageHandleStandardArgs) -# handle the QUIETLY and REQUIRED arguments and set JEMALLOC_FOUND to TRUE -# if all listed variables are TRUE -find_package_handle_standard_args(JeMalloc DEFAULT_MSG - JEMALLOC_LIBRARY JEMALLOC_INCLUDE_DIR) - -mark_as_advanced(JEMALLOC_INCLUDE_DIR JEMALLOC_LIBRARY) diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt index 63cb3cc0d6..442d91524b 100644 --- a/config/CMakeLists.txt +++ b/config/CMakeLists.txt @@ -47,10 +47,6 @@ if(Iconv_FOUND) set(HAVE_ICONV 1) endif() -if(JEMALLOC_FOUND) - set(HAVE_JEMALLOC 1) -endif() - check_function_exists(_putenv_s HAVE_PUTENV_S) if(WIN32 AND NOT HAVE_PUTENV_S) message(SEND_ERROR "_putenv_s() function not found on your system.") diff --git a/config/config.h.in b/config/config.h.in index 106013425d..2781e9a3ba 100644 --- a/config/config.h.in +++ b/config/config.h.in @@ -62,7 +62,6 @@ #cmakedefine FEAT_TUI #ifndef UNIT_TESTING -#cmakedefine HAVE_JEMALLOC #cmakedefine LOG_LIST_ACTIONS #endif diff --git a/contrib/local.mk.example b/contrib/local.mk.example index c347eb9e0d..52a5505399 100644 --- a/contrib/local.mk.example +++ b/contrib/local.mk.example @@ -7,10 +7,6 @@ # These CFLAGS can be used in addition to those specified in CMakeLists.txt: # CMAKE_EXTRA_FLAGS="-DCMAKE_C_FLAGS=-ftrapv -Wlogical-op" -# By default, the jemalloc family of memory allocation functions are used. -# Uncomment the following to instead use libc memory allocation functions. -# CMAKE_EXTRA_FLAGS += -DENABLE_JEMALLOC=OFF - # Sets the build type; defaults to Debug. Valid values: # # - Debug: Disables optimizations (-O0), enables debug information. @@ -36,7 +32,6 @@ # them. # # DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_BUSTED=OFF -# DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_JEMALLOC=OFF # DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_LIBTERMKEY=OFF # DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_LIBUV=OFF # DEPS_CMAKE_FLAGS += -DUSE_BUNDLED_LIBVTERM=OFF diff --git a/src/coverity-model.c b/src/coverity-model.c index 3c38e4ae4d..2fd55c332c 100644 --- a/src/coverity-model.c +++ b/src/coverity-model.c @@ -34,32 +34,6 @@ int uv_pipe_open(struct uv_pipe_s *handle, int fd) return result; } -// Issue 2422 -// -// Teach coverity about jemalloc functions, so that it understands -// they are equivalent to malloc ones. - -void *je_malloc(size_t size) -{ - return __coverity_alloc__(size); -} - -void je_free(void *ptr) -{ - __coverity_free__(ptr); -} - -void *je_calloc(size_t count, size_t size) -{ - return je_malloc(count * size); -} - -void *je_realloc(void *ptr, size_t size) -{ - je_free(ptr); - return je_malloc(size); -} - // Hint Coverity that adding item to d avoids losing track // of the memory allocated for item. typedef struct {} dictitem_T; diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index a2c4e677d4..928d473b04 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -397,11 +397,6 @@ endif() set(NVIM_EXEC_LINK_LIBRARIES ${NVIM_LINK_LIBRARIES} ${LUA_PREFERRED_LIBRARIES}) -# Don't use jemalloc in the unit test library. -if(JEMALLOC_FOUND) - list(APPEND NVIM_EXEC_LINK_LIBRARIES ${JEMALLOC_LIBRARIES}) -endif() - if(POLICY CMP0069) cmake_policy(SET CMP0069 NEW) endif() diff --git a/src/nvim/memory.c b/src/nvim/memory.c index d38079ca72..b49b521bc9 100644 --- a/src/nvim/memory.c +++ b/src/nvim/memory.c @@ -18,35 +18,15 @@ #include "nvim/ui.h" #include "nvim/api/vim.h" -#ifdef HAVE_JEMALLOC -// Force je_ prefix on jemalloc functions. -# define JEMALLOC_NO_DEMANGLE -# include -#endif - #ifdef UNIT_TESTING # define malloc(size) mem_malloc(size) # define calloc(count, size) mem_calloc(count, size) # define realloc(ptr, size) mem_realloc(ptr, size) # define free(ptr) mem_free(ptr) -# ifdef HAVE_JEMALLOC -MemMalloc mem_malloc = &je_malloc; -MemFree mem_free = &je_free; -MemCalloc mem_calloc = &je_calloc; -MemRealloc mem_realloc = &je_realloc; -# else MemMalloc mem_malloc = &malloc; MemFree mem_free = &free; MemCalloc mem_calloc = &calloc; MemRealloc mem_realloc = &realloc; -# endif -#else -# ifdef HAVE_JEMALLOC -# define malloc(size) je_malloc(size) -# define calloc(count, size) je_calloc(count, size) -# define realloc(ptr, size) je_realloc(ptr, size) -# define free(ptr) je_free(ptr) -# endif #endif #ifdef INCLUDE_GENERATED_DECLARATIONS diff --git a/src/nvim/version.c b/src/nvim/version.c index 20b71ab724..b7c9140b7f 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -62,12 +62,6 @@ static char *features[] = { "-iconv", #endif -#ifdef HAVE_JEMALLOC -"+jemalloc", -#else -"-jemalloc", -#endif - #ifdef FEAT_TUI "+tui", #else diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt index 015b3ecbd4..b7c67c254f 100644 --- a/third-party/CMakeLists.txt +++ b/third-party/CMakeLists.txt @@ -30,7 +30,6 @@ set(DEPS_DOWNLOAD_DIR "${DEPS_BUILD_DIR}/downloads" CACHE PATH "Dependencies dow option(USE_BUNDLED "Use bundled dependencies." ON) option(USE_BUNDLED_GPERF "Use the bundled version of gperf." ${USE_BUNDLED}) -option(USE_BUNDLED_JEMALLOC "Use the bundled jemalloc." ${USE_BUNDLED}) option(USE_BUNDLED_UNIBILIUM "Use the bundled unibilium." ${USE_BUNDLED}) option(USE_BUNDLED_LIBTERMKEY "Use the bundled libtermkey." ${USE_BUNDLED}) option(USE_BUNDLED_LIBVTERM "Use the bundled libvterm." ${USE_BUNDLED}) @@ -150,9 +149,6 @@ set(LIBTERMKEY_SHA256 6c0d87c94ab9915e76ecd313baec08dedf3bd56de83743d9aa923a0819 set(LIBVTERM_URL https://github.com/neovim/libvterm/archive/3f62ac6b7bdffda39d68f723fb1806dfd6d6382d.tar.gz) set(LIBVTERM_SHA256 1c8b318370f00f831f43e3ec86a48984250e3ee5c76beb106a421c9a42286ac5) -set(JEMALLOC_URL https://github.com/jemalloc/jemalloc/releases/download/4.5.0/jemalloc-4.5.0.tar.bz2) -set(JEMALLOC_SHA256 9409d85664b4f135b77518b0b118c549009dc10f6cba14557d170476611f6780) - set(LUV_URL https://github.com/luvit/luv/archive/1.9.1-1.tar.gz) set(LUV_SHA256 562b9efaad30aa051a40eac9ade0c3df48bb8186763769abe47ec3fb3edb1268) @@ -212,10 +208,6 @@ if(USE_BUNDLED_LUAROCKS) include(BuildLuarocks) endif() -if(USE_BUNDLED_JEMALLOC) - include(BuildJeMalloc) -endif() - if(USE_BUNDLED_LUV) include(BuildLuv) endif() diff --git a/third-party/cmake/BuildJeMalloc.cmake b/third-party/cmake/BuildJeMalloc.cmake deleted file mode 100644 index 637aadaad9..0000000000 --- a/third-party/cmake/BuildJeMalloc.cmake +++ /dev/null @@ -1,24 +0,0 @@ -if(WIN32) - message(STATUS "Building jemalloc in Windows is not supported (skipping)") - return() -endif() - -ExternalProject_Add(jemalloc - PREFIX ${DEPS_BUILD_DIR} - URL ${JEMALLOC_URL} - DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/jemalloc - DOWNLOAD_COMMAND ${CMAKE_COMMAND} - -DPREFIX=${DEPS_BUILD_DIR} - -DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/jemalloc - -DURL=${JEMALLOC_URL} - -DEXPECTED_SHA256=${JEMALLOC_SHA256} - -DTARGET=jemalloc - -DUSE_EXISTING_SRC_DIR=${USE_EXISTING_SRC_DIR} - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake - BUILD_IN_SOURCE 1 - CONFIGURE_COMMAND ${DEPS_BUILD_DIR}/src/jemalloc/configure - CC=${DEPS_C_COMPILER} --prefix=${DEPS_INSTALL_DIR} - BUILD_COMMAND "" - INSTALL_COMMAND ${MAKE_PRG} install_include install_lib_static) - -list(APPEND THIRD_PARTY_DEPS jemalloc)