From a01968c3b090db55cc36cccc0eb8ded54ff1de6f Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Fri, 6 Jun 2025 14:53:24 +1000 Subject: fetch jemalloc from vcpkg --- source/CMakeLists.txt | 9 ++++++--- source/CMakePresets.json | 3 ++- source/core/StarMemory.cpp | 3 +-- source/vcpkg.json | 4 +++- 4 files changed, 12 insertions(+), 7 deletions(-) (limited to 'source') diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 131c6ad..db36cd6 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -457,11 +457,14 @@ endif() # Find all required external libraries, based on build settings... + + + if(STAR_USE_JEMALLOC) - # Assumes jemalloc was configured with a "je_" function prefix - find_package(JeMalloc REQUIRED) + find_package(PkgConfig) + pkg_check_modules(JEMALLOC REQUIRED jemalloc) - include_directories(SYSTEM ${JEMALLOC_INCLUDE_DIR}) + include_directories(SYSTEM ${JEMALLOC_INCLUDE_DIRS}) set(STAR_EXT_LIBS ${JEMALLOC_LIBRARY}) endif() diff --git a/source/CMakePresets.json b/source/CMakePresets.json index 8deba06..61b4502 100644 --- a/source/CMakePresets.json +++ b/source/CMakePresets.json @@ -32,7 +32,8 @@ "CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded$<$:Debug>DLL", "CMAKE_INCLUDE_PATH": "${sourceParentDir}/lib/windows/include", "CMAKE_LIBRARY_PATH": "${sourceParentDir}/lib/windows", - "STAR_USE_RPMALLOC": true + "STAR_USE_RPMALLOC": false, + "STAR_USE_JEMALLOC": true }, "vendor": { "microsoft.com/VisualStudioSettings/CMake/1.0": { diff --git a/source/core/StarMemory.cpp b/source/core/StarMemory.cpp index 6ecc509..c7818f3 100644 --- a/source/core/StarMemory.cpp +++ b/source/core/StarMemory.cpp @@ -50,8 +50,7 @@ namespace Star { } void free(void* ptr, size_t size) { - if (ptr) - ::sdallocx(ptr, size, 0); + ::free(ptr); } #endif #elif STAR_USE_MIMALLOC diff --git a/source/vcpkg.json b/source/vcpkg.json index 6eab46c..f6aa482 100644 --- a/source/vcpkg.json +++ b/source/vcpkg.json @@ -10,6 +10,8 @@ "libpng", "opus", "zstd", - "mimalloc" + "mimalloc", + "jemalloc", + "pkgconf" ] } \ No newline at end of file -- cgit v1.2.3