aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/CMakeLists.txt6
-rw-r--r--src/nvim/memory.c18
-rw-r--r--src/nvim/version.c20
3 files changed, 25 insertions, 19 deletions
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index 31612c7f47..810809ea17 100644
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -163,7 +163,7 @@ list(APPEND NVIM_LINK_LIBRARIES
${LUAJIT_LIBRARIES}
${LIBVTERM_LIBRARIES}
${LIBTERMKEY_LIBRARIES}
- ${LIBUNIBILIUM_LIBRARIES}
+ ${UNIBILIUM_LIBRARIES}
m
util
${CMAKE_THREAD_LIBS_INIT}
@@ -171,8 +171,8 @@ list(APPEND NVIM_LINK_LIBRARIES
set(NVIM_EXEC_LINK_LIBRARIES ${NVIM_LINK_LIBRARIES})
-if(USE_JEMALLOC)
- # dont use jemalloc in the unit test library
+# Don't use jemalloc in the unit test library.
+if(JEMALLOC_FOUND)
list(APPEND NVIM_EXEC_LINK_LIBRARIES ${JEMALLOC_LIBRARIES})
endif()
diff --git a/src/nvim/memory.c b/src/nvim/memory.c
index 2d4259a238..8628661a98 100644
--- a/src/nvim/memory.c
+++ b/src/nvim/memory.c
@@ -14,16 +14,18 @@
#include "nvim/misc1.h"
#include "nvim/ui.h"
-#ifdef INCLUDE_GENERATED_DECLARATIONS
-# include "memory.c.generated.h"
+#ifdef HAVE_JEMALLOC
+// Force je_ prefix on jemalloc functions.
+# define JEMALLOC_NO_DEMANGLE
+# include <jemalloc/jemalloc.h>
+# 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
-#if defined(USE_JEMALLOC) && !defined(UNIT_TESTING)
-#include "jemalloc/jemalloc.h"
-#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)
+#ifdef INCLUDE_GENERATED_DECLARATIONS
+# include "memory.c.generated.h"
#endif
/// Try to free memory. Used when trying to recover from out of memory errors.
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 3ca0b254f4..4b4d28dcc2 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -47,21 +47,25 @@ char *version_cflags = "Compilation: " NVIM_VERSION_CFLAGS;
static char *features[] = {
#ifdef HAVE_ACL
"+acl",
-#else // ifdef HAVE_ACL
+#else
"-acl",
-#endif // ifdef HAVE_ACL
+#endif
#if (defined(HAVE_ICONV_H) && defined(USE_ICONV)) || defined(DYNAMIC_ICONV)
# ifdef DYNAMIC_ICONV
"+iconv/dyn",
-# else // ifdef DYNAMIC_ICONV
+# else
"+iconv",
-# endif // ifdef DYNAMIC_ICONV
-#else // if (defined(HAVE_ICONV_H) && defined(USE_ICONV))
- // ||defined(DYNAMIC_ICONV)
+# endif
+#else
"-iconv",
-#endif // if (defined(HAVE_ICONV_H) && defined(USE_ICONV))
- // || defined(DYNAMIC_ICONV)
+#endif
+
+#ifdef HAVE_JEMALLOC
+ "+jemalloc",
+#else
+ "-jemalloc",
+#endif
NULL
};