Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,13 @@ include(AutoOptionHelpers)
auto_option(HWLOC FEATURE_VAR TS_USE_HWLOC PACKAGE_DEPENDS hwloc)
auto_option(JEMALLOC
FEATURE_VAR TS_HAS_JEMALLOC
DEFAULT OFF
PACKAGE_DEPENDS jemalloc
)
auto_option(MIMALLOC
FEATURE_VAR TS_HAS_MIMALLOC
PACKAGE_DEPENDS mimalloc
DEFAULT OFF
PACKAGE_DEPENDS mimalloc
)
auto_option(LUAJIT PACKAGE_DEPENDS LuaJIT)
auto_option(UNWIND FEATURE_VAR TS_USE_REMOTE_UNWINDING PACKAGE_DEPENDS unwind)
Expand All @@ -67,6 +68,7 @@ option(BUILD_REGRESSION_TESTING "Build regression tests (default ON)" ON)
option(BUILD_EXPERIMENTAL_PLUGINS "Build the experimental plugins (default OFF)")
set(DEFAULT_STACK_SIZE 1048576 CACHE STRING "Default stack size (default 1048576)")
option(ENABLE_FAST_SDK "Use fast SDK APIs (default OFF)")
option(ENABLE_MALLOC_ALLOCATOR "Use direct malloc allocator over freelist allocator (default OFF)")
option(ENABLE_DOCS "Build docs (default OFF)")
option(ENABLE_DISK_FAILURE_TESTS "Build disk failure tests (enables AIO fault injection, default OFF)" OFF)
if(ENABLE_DISK_FAILURE_TESTS)
Expand Down Expand Up @@ -229,7 +231,7 @@ if(TS_HAS_JEMALLOC AND TS_HAS_MIMALLOC)
endif()

if(TS_HAS_JEMALLOC)
link_libraries(jemalloc)
link_libraries(jemalloc::jemalloc)
elseif(TS_HAS_MIMALLOC)
link_libraries(mimalloc)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
link_libraries(mimalloc)
link_libraries(mimalloc::mimalloc)

here too

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There isn't currently a mimalloc::mimalloc target

endif()
Expand Down Expand Up @@ -258,6 +260,7 @@ if(ENABLE_ASAN)
add_link_options(-fsanitize=address)
endif()

set(TS_USE_MALLOC_ALLOCATOR ${ENABLE_MALLOC_ALLOCATOR})
find_package(ZLIB REQUIRED)

# ncurses is used in traffic_top
Expand Down
4 changes: 4 additions & 0 deletions include/tscore/JeMiAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@
#include <mutex>

#if TS_HAS_JEMALLOC
#if __has_include(<jemalloc/jemalloc.h>)
#include <jemalloc/jemalloc.h>
#else
#include <jemalloc.h>
#endif
#if (JEMALLOC_VERSION_MAJOR == 0)
#error jemalloc has bogus version
#endif
Expand Down
2 changes: 2 additions & 0 deletions include/tscore/ink_config.h.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ const int DEFAULT_STACKSIZE = @DEFAULT_STACK_SIZE@;
#cmakedefine01 TS_HAS_IN6_IS_ADDR_UNSPECIFIED
#cmakedefine01 TS_HAS_IP_TOS
#cmakedefine01 TS_HAS_JEMALLOC
#cmakedefine01 TS_HAS_MIMALLOC
#cmakedefine01 TS_HAS_PROFILER
#cmakedefine01 TS_HAS_QUICHE
#cmakedefine01 TS_HAS_SO_MARK
Expand All @@ -139,6 +140,7 @@ const int DEFAULT_STACKSIZE = @DEFAULT_STACK_SIZE@;
#cmakedefine01 TS_USE_HWLOC
#cmakedefine01 TS_USE_KQUEUE
#cmakedefine01 TS_USE_LINUX_IO_URING
#cmakedefine01 TS_USE_MALLOC_ALLOCATOR
#cmakedefine01 TS_USE_POSIX_CAP
#cmakedefine01 TS_USE_QUIC
#cmakedefine01 TS_USE_REMOTE_UNWINDING
Expand Down
4 changes: 4 additions & 0 deletions include/tscore/ink_memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@
#endif

#if TS_HAS_JEMALLOC
#if __has_include(<jemalloc/jemalloc.h>)
#include <jemalloc/jemalloc.h>
#else
#include <jemalloc.h>
Copy link
Copy Markdown
Contributor

@bryancall bryancall Sep 25, 2023

Choose a reason for hiding this comment

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

We only need to have #include <jemalloc.h> in the code for compiling with cmake. The include directory detection add in the subdir jemalloc.

However, with autotools we need to have the #include <jemalloc/jemalloc.h>

#endif
#elif TS_HAS_MIMALLOC
#include <mimalloc.h>
#elif HAVE_MALLOC_H
Expand Down
4 changes: 1 addition & 3 deletions plugins/experimental/memory_profile/memory_profile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
#include <cstring>
#include <cerrno>
#include <tscore/ink_config.h>
#if TS_HAS_JEMALLOC
#include <jemalloc/jemalloc.h>
#endif
#include <tscore/ink_memory.h>

#define PLUGIN_NAME "memory_profile"

Expand Down