From b07fe6a17015c5e05f1553614006ff97539279eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Wed, 18 Jan 2023 14:15:10 +0100 Subject: [PATCH 01/23] Move abstract type checking in `allocator_deallocator` This allows the use with incomplete types. Fixes #153. --- include/foonathan/memory/deleter.hpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/include/foonathan/memory/deleter.hpp b/include/foonathan/memory/deleter.hpp index 6c9cf5f..a6863fe 100644 --- a/include/foonathan/memory/deleter.hpp +++ b/include/foonathan/memory/deleter.hpp @@ -24,9 +24,6 @@ namespace foonathan template class allocator_deallocator : FOONATHAN_EBO(allocator_reference) { - static_assert(!std::is_abstract::value, - "use allocator_polymorphic_deallocator for storing base classes"); - public: using allocator_type = typename allocator_reference::allocator_type; using value_type = Type; @@ -48,6 +45,8 @@ namespace foonathan /// \requires The deallocator must not have been created by the default constructor. void operator()(value_type* pointer) noexcept { + static_assert(!std::is_abstract::value, + "use allocator_polymorphic_deallocator for storing base classes"); this->deallocate_node(pointer, sizeof(value_type), alignof(value_type)); } @@ -68,8 +67,6 @@ namespace foonathan class allocator_deallocator : FOONATHAN_EBO(allocator_reference) { - static_assert(!std::is_abstract::value, "must not create polymorphic arrays"); - public: using allocator_type = typename allocator_reference::allocator_type; using value_type = Type; @@ -93,6 +90,8 @@ namespace foonathan /// \requires The deallocator must not have been created by the default constructor. void operator()(value_type* pointer) noexcept { + static_assert(!std::is_abstract::value, + "must not create polymorphic arrays"); this->deallocate_array(pointer, size_, sizeof(value_type), alignof(value_type)); } @@ -163,9 +162,6 @@ namespace foonathan template class allocator_deleter : FOONATHAN_EBO(allocator_reference) { - static_assert(!std::is_abstract::value, - "use allocator_polymorphic_deleter for storing base classes"); - public: using allocator_type = typename allocator_reference::allocator_type; using value_type = Type; @@ -188,6 +184,8 @@ namespace foonathan /// \requires The deleter must not have been created by the default constructor. void operator()(value_type* pointer) noexcept { + static_assert(!std::is_abstract::value, + "use allocator_polymorphic_deleter for storing base classes"); pointer->~value_type(); this->deallocate_node(pointer, sizeof(value_type), alignof(value_type)); } @@ -208,8 +206,6 @@ namespace foonathan class allocator_deleter : FOONATHAN_EBO(allocator_reference) { - static_assert(!std::is_abstract::value, "must not create polymorphic arrays"); - public: using allocator_type = typename allocator_reference::allocator_type; using value_type = Type; @@ -232,6 +228,8 @@ namespace foonathan /// \requires The deleter must not have been created by the default constructor. void operator()(value_type* pointer) noexcept { + static_assert(!std::is_abstract::value, + "must not create polymorphic arrays"); for (auto cur = pointer; cur != pointer + size_; ++cur) cur->~value_type(); this->deallocate_array(pointer, size_, sizeof(value_type), alignof(value_type)); @@ -304,4 +302,5 @@ namespace foonathan } // namespace memory } // namespace foonathan -#endif //FOONATHAN_MEMORY_DELETER_HPP_INCLUDED +#endif // FOONATHAN_MEMORY_DELETER_HPP_INCLUDED + From 6ef8880f39abe85c8456bcb40856cfcea817aadc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Sun, 5 Feb 2023 20:29:16 +0100 Subject: [PATCH 02/23] Add default constructor to polymorphic deallocator/deleter Fixes #155. --- include/foonathan/memory/deleter.hpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/include/foonathan/memory/deleter.hpp b/include/foonathan/memory/deleter.hpp index a6863fe..75e99b0 100644 --- a/include/foonathan/memory/deleter.hpp +++ b/include/foonathan/memory/deleter.hpp @@ -126,6 +126,11 @@ namespace foonathan using allocator_type = typename allocator_reference::allocator_type; using value_type = BaseType; + /// \effects Creates it without any associated allocator. + /// The deallocator must not be used if that is the case. + /// \notes This functions is useful if you have want to create an empty smart pointer without giving it an allocator. + allocator_polymorphic_deallocator() noexcept = default; + /// \effects Creates it from a deallocator for a derived type. /// It will deallocate the memory as if done by the derived type. template ::value))> @@ -153,7 +158,7 @@ namespace foonathan } private: - std::size_t derived_size_, derived_alignment_; + std::size_t derived_size_ = 0, derived_alignment_ = 0; }; /// Similar to \ref allocator_deallocator but calls the destructors of the object. @@ -266,6 +271,11 @@ namespace foonathan using allocator_type = typename allocator_reference::allocator_type; using value_type = BaseType; + /// \effects Creates it without any associated allocator. + /// The deleter must not be used if that is the case. + /// \notes This functions is useful if you have want to create an empty smart pointer without giving it an allocator. + allocator_polymorphic_deleter() noexcept = default; + /// \effects Creates it from a deleter for a derived type. /// It will deallocate the memory as if done by the derived type. template ::value))> @@ -296,8 +306,8 @@ namespace foonathan } private: - unsigned short derived_size_, - derived_alignment_; // use unsigned short here to save space + unsigned short derived_size_ = 0, + derived_alignment_ = 0; // use unsigned short here to save space }; } // namespace memory } // namespace foonathan From c1fe2763f4be31ff4c7ab9f4f530767eac1c84c9 Mon Sep 17 00:00:00 2001 From: Nico Schmidt <73886020+nicosmd@users.noreply.github.com> Date: Sat, 29 Apr 2023 22:00:41 +0200 Subject: [PATCH 03/23] Remove static linking for cross compilation (#164) Fixes #162. --- tool/CMakeLists.txt | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tool/CMakeLists.txt b/tool/CMakeLists.txt index a7a650e..b345066 100644 --- a/tool/CMakeLists.txt +++ b/tool/CMakeLists.txt @@ -4,14 +4,6 @@ # builds tools add_executable(foonathan_memory_node_size_debugger test_types.hpp node_size_debugger.hpp node_size_debugger.cpp) -if (CMAKE_CROSSCOMPILING) - # statically link when cross compiling so emulator doesn't need library paths - if (MSVC) - set_target_properties(foonathan_memory_node_size_debugger PROPERTIES LINK_FLAGS "/WHOLEARCHIVE") - else() - set_target_properties(foonathan_memory_node_size_debugger PROPERTIES LINK_FLAGS "-static") - endif() -endif() if (MSVC) target_compile_options(foonathan_memory_node_size_debugger PRIVATE "/bigobj") endif() From f7afdd1985b6dd28f0ecdc81167e42e2ca8977d7 Mon Sep 17 00:00:00 2001 From: Jia Yue Hua <3423893+jiayuehua@users.noreply.github.com> Date: Sun, 18 Jun 2023 18:04:32 +0800 Subject: [PATCH 04/23] Update CMakeLists.txt fix include path (#165) --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ddbc459..0b82f0b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ set(CMAKE_DEBUG_POSTFIX "-dbg") if(UNIX OR VXWORKS) include(GNUInstallDirs) - set(FOONATHAN_MEMORY_INC_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}/foonathan_memory") + set(FOONATHAN_MEMORY_INC_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}") set(FOONATHAN_MEMORY_RUNTIME_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}") set(FOONATHAN_MEMORY_LIBRARY_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}") set(FOONATHAN_MEMORY_ARCHIVE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}") @@ -29,7 +29,7 @@ if(UNIX OR VXWORKS) set(FOONATHAN_MEMORY_CMAKE_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/foonathan_memory/cmake") set(FOONATHAN_MEMORY_ADDITIONAL_FILES_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/foonathan_memory") elseif(WIN32) - set(FOONATHAN_MEMORY_INC_INSTALL_DIR "include/foonathan_memory") + set(FOONATHAN_MEMORY_INC_INSTALL_DIR "include") set(FOONATHAN_MEMORY_RUNTIME_INSTALL_DIR "bin") set(FOONATHAN_MEMORY_LIBRARY_INSTALL_DIR "bin") set(FOONATHAN_MEMORY_ARCHIVE_INSTALL_DIR "lib") From aec147d963f754ac08eebfdf52db7b349a84b85c Mon Sep 17 00:00:00 2001 From: Zhuo Zhang Date: Wed, 21 Jun 2023 19:50:42 +0800 Subject: [PATCH 05/23] Remove duplicated names in contributor list in README (#166) --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index ea44f14..dc9f065 100644 --- a/README.md +++ b/README.md @@ -238,11 +238,8 @@ And big thanks to the contributors as well: * @j-carl * @kaidokert * @maksqwe -* @maksqwe -* @moazzamak * @moazzamak * @myd7349 -* @myd7349 * @nicolastagliani * @quattrinili * @razr From d54c7f16fa903a06974ce02ad6ef383fe2230b6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Sun, 9 Jul 2023 10:42:11 +0200 Subject: [PATCH 06/23] Assume `thread_local` and destructors are supported Fixes #167. --- src/temporary_allocator.cpp | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/src/temporary_allocator.cpp b/src/temporary_allocator.cpp index 2101c5f..77e4672 100644 --- a/src/temporary_allocator.cpp +++ b/src/temporary_allocator.cpp @@ -60,31 +60,11 @@ void detail::temporary_block_allocator::deallocate_block(memory_block block) // lifetime managment through the nifty counter and the list // note: I could have used a simple `thread_local` variable for the temporary stack // but this could lead to issues with destruction order -// and more importantly I have to support platforms that can't handle non-trivial thread local's // hence I need to dynamically allocate the stack's and store them in a container // on program exit the container is iterated and all stack's are properly destroyed -// if a thread exit can be detected, the dynamic memory of the stack is already released, +// if a thread exit is detected, the dynamic memory of the stack is already released, // but not the stack itself destroyed -#if !defined(__MINGW64__) - -// only use the thread exit detector if we have thread local and are not running on MinGW due to a bug -// see: https://sourceforge.net/p/mingw-w64/bugs/527/ -#define FOONATHAN_MEMORY_THREAD_EXIT_DETECTOR 1 - -#else -#define FOONATHAN_MEMORY_THREAD_EXIT_DETECTOR 0 - -#if defined(_MSC_VER) -#pragma message( \ - "thread_local doesn't support destructors, need to use the temporary_stack_initializer to ensure proper cleanup of the temporary memory") -#else -#warning \ - "thread_local doesn't support destructors, need to use the temporary_stack_initializer to ensure proper cleanup of the temporary memory" -#endif - -#endif - static class detail::temporary_stack_list { public: @@ -151,8 +131,6 @@ namespace thread_local std::size_t nifty_counter; thread_local temporary_stack* temp_stack = nullptr; -#if FOONATHAN_MEMORY_THREAD_EXIT_DETECTOR - // don't use this on a bug thread_local struct thread_exit_detector_t { ~thread_exit_detector_t() noexcept @@ -166,7 +144,6 @@ namespace temporary_stack_list_obj.clear(*temp_stack); } } thread_exit_detector; -#endif } // namespace detail::temporary_stack_list_node::temporary_stack_list_node(int) noexcept : in_use_(true) @@ -174,9 +151,7 @@ detail::temporary_stack_list_node::temporary_stack_list_node(int) noexcept : in_ next_ = temporary_stack_list_obj.first.load(); while (!temporary_stack_list_obj.first.compare_exchange_weak(next_, this)) ; -#if FOONATHAN_MEMORY_THREAD_EXIT_DETECTOR (void)&thread_exit_detector; // ODR-use it, so it will be created -#endif } detail::temporary_allocator_dtor_t::temporary_allocator_dtor_t() noexcept From 3ab8c6240322e5369c92b1984200d6433b540a60 Mon Sep 17 00:00:00 2001 From: cohdan <145435761+cohdan@users.noreply.github.com> Date: Thu, 28 Dec 2023 15:45:51 +0200 Subject: [PATCH 07/23] Expose memory_pool's underlying arena 'owns' method to users of memory_pool itself' (#174) --- include/foonathan/memory/memory_pool.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/foonathan/memory/memory_pool.hpp b/include/foonathan/memory/memory_pool.hpp index d764365..a7e5961 100644 --- a/include/foonathan/memory/memory_pool.hpp +++ b/include/foonathan/memory/memory_pool.hpp @@ -222,6 +222,11 @@ namespace foonathan return arena_.get_allocator(); } + /// \returns If `ptr` is in memory owned by the underlying arena. + bool owns(const void* ptr) const noexcept + { + return arena_.owns(ptr); + } private: allocator_info info() const noexcept { From d989f4107fd755b61301d5c11dab59ebe51a6607 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Thu, 28 Dec 2023 15:37:47 +0100 Subject: [PATCH 08/23] Use the current block size, not the next block size for `memory_pool_collection::def_capacity` Fixes #173. --- include/foonathan/memory/memory_pool_collection.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/foonathan/memory/memory_pool_collection.hpp b/include/foonathan/memory/memory_pool_collection.hpp index e6952e9..c76b4e8 100644 --- a/include/foonathan/memory/memory_pool_collection.hpp +++ b/include/foonathan/memory/memory_pool_collection.hpp @@ -324,7 +324,7 @@ namespace foonathan std::size_t def_capacity() const noexcept { - return arena_.next_block_size() / pools_.size(); + return arena_.current_block().size / pools_.size(); } detail::fixed_memory_stack allocate_block() From 016c9fbd61b57ed2058551dcf225c15a0e716cce Mon Sep 17 00:00:00 2001 From: Jeremi Mucha Date: Mon, 8 Jan 2024 18:37:38 +0100 Subject: [PATCH 09/23] Fix virtual_block_allocator::deallocate_block (#175) * deallocate_block() now calls virtual_memory_decommit with the number of pages to decommit rather than the block size * extended virtual_block_allocator dtor requirements --- include/foonathan/memory/virtual_memory.hpp | 2 ++ src/virtual_memory.cpp | 2 +- test/default_allocator.cpp | 13 +++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/include/foonathan/memory/virtual_memory.hpp b/include/foonathan/memory/virtual_memory.hpp index 68705e9..73f11e8 100644 --- a/include/foonathan/memory/virtual_memory.hpp +++ b/include/foonathan/memory/virtual_memory.hpp @@ -137,6 +137,8 @@ namespace foonathan explicit virtual_block_allocator(std::size_t block_size, std::size_t no_blocks); /// \effects Releases the reserved virtual memory. + /// \requires All previously \ref allocate_block() committed blocks must be decommitted via + /// \ref deallocate_block(), otherwise the blocks that have not been deallocated are leaked. ~virtual_block_allocator() noexcept; /// @{ diff --git a/src/virtual_memory.cpp b/src/virtual_memory.cpp index 7cc7a6d..2e18649 100644 --- a/src/virtual_memory.cpp +++ b/src/virtual_memory.cpp @@ -230,7 +230,7 @@ void virtual_block_allocator::deallocate_block(memory_block block) noexcept { return static_cast(block.memory) == cur_ - block_size_; }, info(), block.memory); cur_ -= block_size_; - virtual_memory_decommit(cur_, block_size_); + virtual_memory_decommit(cur_, block_size_ / virtual_memory_page_size); } allocator_info virtual_block_allocator::info() noexcept diff --git a/test/default_allocator.cpp b/test/default_allocator.cpp index bdf7d53..6d2f91f 100644 --- a/test/default_allocator.cpp +++ b/test/default_allocator.cpp @@ -9,6 +9,7 @@ #include #include "detail/align.hpp" +#include "memory_arena.hpp" using namespace foonathan::memory; @@ -72,3 +73,15 @@ TEST_CASE("virtual_memory_allocator") virtual_memory_allocator alloc; check_default_allocator(alloc, get_virtual_memory_page_size()); } + +TEST_CASE("virtual_block_allocator") +{ + auto const page_size = get_virtual_memory_page_size(); + constexpr std::size_t no_blocks{8u}; + + virtual_block_allocator alloc{page_size, no_blocks}; + auto block = alloc.allocate_block(); + REQUIRE(block.memory != nullptr); + REQUIRE(block.size == page_size); + alloc.deallocate_block(block); +} From f3beb75e998972150d67e792b8d66f32c84ea96d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Fri, 2 May 2025 11:35:48 -0600 Subject: [PATCH 10/23] Fix CMake deprecation warning --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b82f0b..363c82e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,10 @@ # root CMakeLists.txt, specifies option and interface library cmake_minimum_required(VERSION 3.14) +if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") + cmake_policy(SET CMP0135 NEW) +endif() + project(FOONATHAN_MEMORY) set(FOONATHAN_MEMORY_VERSION_MAJOR 0 CACHE STRING "major version of memory" FORCE) From b1fd38a6d73ae2b6179d8c505a644310a88e38f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Fri, 2 May 2025 11:35:57 -0600 Subject: [PATCH 11/23] Update doctest to latest version --- test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 37359ea..caf8eb3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -11,7 +11,7 @@ target_include_directories(foonathan_memory_profiling PRIVATE # Fetch doctest. message(STATUS "Fetching doctest") include(FetchContent) -FetchContent_Declare(doctest URL https://github.com/doctest/doctest/archive/refs/tags/v2.4.9.zip) +FetchContent_Declare(doctest URL https://github.com/doctest/doctest/archive/refs/tags/v2.4.12.zip) FetchContent_MakeAvailable(doctest) set(tests From 0713893f49b1ccf369bbbe69d795505dde241583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Fri, 2 May 2025 11:40:41 -0600 Subject: [PATCH 12/23] Update CI to use my docker containers --- .github/workflows/feature_ci.yml | 39 ++++++++--------- .github/workflows/main_ci.yml | 73 +++++++++++++++++--------------- 2 files changed, 57 insertions(+), 55 deletions(-) diff --git a/.github/workflows/feature_ci.yml b/.github/workflows/feature_ci.yml index c1041cb..9cee81e 100644 --- a/.github/workflows/feature_ci.yml +++ b/.github/workflows/feature_ci.yml @@ -2,7 +2,7 @@ name: Feature CI on: push: - branches-ignore: ['main'] + branches-ignore: ['main', 'fix/*'] pull_request: jobs: @@ -10,42 +10,34 @@ jobs: strategy: fail-fast: false matrix: - image: - # List: https://github.com/conan-io/conan-docker-tools - - gcc10 - - gcc5 - - clang10 - - clang40 - sharedlibs: [OFF, ON] + image: ["gcc:7", "gcc:14", "clang:6", "clang:18"] runs-on: ubuntu-latest container: - image: conanio/${{matrix.image}} - options: --user root + image: ghcr.io/foonathan/${{matrix.image}} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Create Build Environment run: cmake -E make_directory build - name: Configure working-directory: build/ - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=${{matrix.sharedlibs}} + run: cmake -GNinja $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Debug - name: Build working-directory: build/ - run: cmake --build . --config Debug + run: cmake --build . - name: Test working-directory: build/ - run: ctest -C Debug --output-on-failure + run: ctest --output-on-failure macos: strategy: fail-fast: false matrix: - xcode: ['11', '13'] - sharedlibs: [OFF, ON] + xcode: ['15', '16'] - runs-on: macos-11 + runs-on: macos-14 steps: - uses: actions/checkout@v2 @@ -54,10 +46,12 @@ jobs: xcode-version: ${{matrix.xcode}} - name: Create Build Environment run: cmake -E make_directory build + - name: Install ninja + run: brew install ninja - name: Configure working-directory: build/ - run: cmake $GITHUB_WORKSPACE -DBUILD_SHARED_LIBS=${{matrix.sharedlibs}} + run: cmake -GNinja $GITHUB_WORKSPACE - name: Build working-directory: build/ run: cmake --build . @@ -69,21 +63,22 @@ jobs: strategy: fail-fast: false matrix: - sharedlibs: [OFF, ON] + arch: [Win32, x64] - runs-on: windows-2019 + runs-on: windows-2022 steps: - uses: actions/checkout@v2 - name: Create Build Environment run: cmake -E make_directory build + - name: Configure shell: bash working-directory: build/ - run: cmake $GITHUB_WORKSPACE -G"Visual Studio 16 2019" -DBUILD_SHARED_LIBS=${{matrix.sharedlibs}} + run: cmake $GITHUB_WORKSPACE -G"Visual Studio 17 2022" -A ${{matrix.arch}} - name: Build working-directory: build/ - run: cmake --build . --config Debug + run: cmake --build . --config Debug -j 2 - name: Test working-directory: build/ run: ctest -C Debug --output-on-failure diff --git a/.github/workflows/main_ci.yml b/.github/workflows/main_ci.yml index 65c7be5..dd74e82 100644 --- a/.github/workflows/main_ci.yml +++ b/.github/workflows/main_ci.yml @@ -2,7 +2,7 @@ name: Main CI on: push: - branches: [main] + branches: [main, fix/*] jobs: linux: @@ -10,53 +10,56 @@ jobs: fail-fast: false matrix: image: - # List: https://github.com/conan-io/conan-docker-tools - - gcc10 - - gcc9 - - gcc8 - - gcc7 - - gcc6 - - gcc5 - - clang10 - - clang9 - - clang8 - - clang7 - - clang60 - - clang50 - - clang40 + - "gcc:7" + - "gcc:8" + - "gcc:9" + - "gcc:10" + - "gcc:11" + - "gcc:12" + - "gcc:13" + - "gcc:14" + - "clang:6" + - "clang:7" + - "clang:8" + - "clang:9" + - "clang:10" + - "clang:11" + - "clang:12" + - "clang:13" + - "clang:14" + - "clang:15" + - "clang:16" + - "clang:17" + - "clang:18" build_type: [Debug, Release] - sharedlibs: [OFF, ON] runs-on: ubuntu-latest container: - image: conanio/${{matrix.image}} - options: --user root + image: ghcr.io/foonathan/${{matrix.image}} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Create Build Environment run: cmake -E make_directory build + - name: Configure working-directory: build/ - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DBUILD_SHARED_LIBS=${{matrix.sharedlibs}} + run: cmake -GNinja $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{matrix.build_type}} - name: Build working-directory: build/ - run: cmake --build . --config ${{matrix.build_type}} + run: cmake --build . - name: Test working-directory: build/ - run: ctest -C ${{matrix.build_type}} --output-on-failure + run: ctest --output-on-failure macos: strategy: fail-fast: false matrix: - xcode: - - '11' - - '12' - - '13' - sharedlibs: [OFF, ON] + xcode: ['15', '16'] + build_type: [Debug, Release] - runs-on: macos-11 + runs-on: macos-14 steps: - uses: actions/checkout@v2 @@ -65,9 +68,12 @@ jobs: xcode-version: ${{matrix.xcode}} - name: Create Build Environment run: cmake -E make_directory build + - name: Install ninja + run: brew install ninja + - name: Configure working-directory: build/ - run: cmake $GITHUB_WORKSPACE -DBUILD_SHARED_LIBS=${{matrix.sharedlibs}} + run: cmake -GNinja $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{matrix.build_type}} - name: Build working-directory: build/ run: cmake --build . @@ -79,9 +85,9 @@ jobs: strategy: fail-fast: false matrix: + toolset: ['v142', 'v143', 'ClangCL'] build_type: [Debug, Release] - sharedlibs: [OFF, ON] - std: [14, 17, 20] + arch: [Win32, x64] runs-on: windows-2022 @@ -89,13 +95,14 @@ jobs: - uses: actions/checkout@v2 - name: Create Build Environment run: cmake -E make_directory build + - name: Configure shell: bash working-directory: build/ - run: cmake $GITHUB_WORKSPACE -G"Visual Studio 17 2022" -DCMAKE_CXX_STANDARD=${{matrix.std}} -DBUILD_SHARED_LIBS=${{matrix.sharedlibs}} + run: cmake $GITHUB_WORKSPACE -G"Visual Studio 17 2022" -T ${{matrix.toolset}} -A ${{matrix.arch}} - name: Build working-directory: build/ - run: cmake --build . --config ${{matrix.build_type}} + run: cmake --build . --config ${{matrix.build_type}} -j 2 - name: Test working-directory: build/ run: ctest -C ${{matrix.build_type}} --output-on-failure From 8c5210a5ae94dee274df32e585b8cc46b6afae1a Mon Sep 17 00:00:00 2001 From: "Chaoyang.Wang" Date: Sat, 8 Feb 2025 10:31:02 +0800 Subject: [PATCH 13/23] Fix unused variables caused by undefined `FOONATHAN_MEMORY_DEBUG_ASSERT` Fixes #183, #184, #189. --- src/virtual_memory.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/virtual_memory.cpp b/src/virtual_memory.cpp index 2e18649..8be7a52 100644 --- a/src/virtual_memory.cpp +++ b/src/virtual_memory.cpp @@ -49,6 +49,7 @@ void foonathan::memory::virtual_memory_release(void* pages, std::size_t) noexcep { auto result = VirtualFree(pages, 0u, MEM_RELEASE); FOONATHAN_MEMORY_ASSERT_MSG(result, "cannot release pages"); + (void)result; } void* foonathan::memory::virtual_memory_commit(void* memory, std::size_t no_pages) noexcept @@ -70,6 +71,7 @@ void foonathan::memory::virtual_memory_decommit(void* memory, std::size_t no_pag { auto result = VirtualFree(memory, no_pages * virtual_memory_page_size, MEM_DECOMMIT); FOONATHAN_MEMORY_ASSERT_MSG(result, "cannot decommit memory"); + (void)result; } #elif defined(__unix__) || defined(__APPLE__) || defined(__VXWORKS__) \ || defined(__QNXNTO__) // POSIX systems From 0bc8c818b1e74c2244a10cefb8ba76a0574f0107 Mon Sep 17 00:00:00 2001 From: Basil Fierz Date: Fri, 2 May 2025 20:00:36 +0200 Subject: [PATCH 14/23] Fixes an issue where CMake clears the local variable instead of setting it (CMP0126) (#190) --- CMakeLists.txt | 2 +- src/CMakeLists.txt | 10 +++++----- tool/CMakeLists.txt | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 363c82e..7605795 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ project(FOONATHAN_MEMORY) set(FOONATHAN_MEMORY_VERSION_MAJOR 0 CACHE STRING "major version of memory" FORCE) set(FOONATHAN_MEMORY_VERSION_MINOR 7 CACHE STRING "minor version of memory" FORCE) set(FOONATHAN_MEMORY_VERSION_PATCH 3 CACHE STRING "patch version of memory" FORCE) -set(FOONATHAN_MEMORY_VERSION "${FOONATHAN_MEMORY_VERSION_MAJOR}.${FOONATHAN_MEMORY_VERSION_MINOR}.${FOONATHAN_MEMORY_VERSION_PATCH}" +set(FOONATHAN_MEMORY_VERSION "$CACHE{FOONATHAN_MEMORY_VERSION_MAJOR}.$CACHE{FOONATHAN_MEMORY_VERSION_MINOR}.$CACHE{FOONATHAN_MEMORY_VERSION_PATCH}" CACHE STRING "version of memory" FORCE) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7b26572..7501be2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -87,9 +87,9 @@ target_include_directories(foonathan_memory PUBLIC $ Date: Sat, 3 May 2025 02:02:05 +0800 Subject: [PATCH 15/23] Fix typo in `default_allocator` (#187) --- include/foonathan/memory/default_allocator.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/foonathan/memory/default_allocator.hpp b/include/foonathan/memory/default_allocator.hpp index 29a2139..4c213ff 100644 --- a/include/foonathan/memory/default_allocator.hpp +++ b/include/foonathan/memory/default_allocator.hpp @@ -25,7 +25,7 @@ namespace foonathan /// Arena allocators like \ref memory_stack or \ref memory_pool allocate memory by subdividing a huge block. /// They get a \concept{concept_blockallocator,BlockAllocator} that will be used for their internal allocation, /// this type is the default value. - /// \requiredbe Its type can be changed via the CMake option \c FOONATHAN_MEMORY_DEFAULT_ALLCOATOR, + /// \requiredbe Its type can be changed via the CMake option \c FOONATHAN_MEMORY_DEFAULT_ALLOCATOR, /// but it must be one of the following: \ref heap_allocator, \ref new_allocator, \ref malloc_allocator, \ref static_allocator, \ref virtual_memory_allocator. /// \defaultbe The default is \ref heap_allocator. /// \ingroup allocator From 8c1cd37ebe42f25b41e34c0f837c5377f0f2195c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9C=A7=E9=9B=A8=E9=AD=94=E7=90=86=E6=B2=99?= Date: Fri, 2 May 2025 12:02:28 -0600 Subject: [PATCH 16/23] Close angle bracket (#185) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dc9f065..2d11968 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ int main() // list_node_size::value is the size of each node of a std::list memory::memory_pool<> pool(memory::list_node_size::value, 4_KiB); - // just an alias for std::list> + // just an alias for std::list>> // a std::list using a memory_pool // std_allocator stores a reference to a RawAllocator and provides the Allocator interface memory::list> list(pool); From e3d3fcb9b18673123e6741a265b05f37dac02833 Mon Sep 17 00:00:00 2001 From: mosfet80 Date: Fri, 2 May 2025 20:04:08 +0200 Subject: [PATCH 17/23] Fix node.js deprecation (#188) --- .github/workflows/code_coverage.yml | 2 +- .github/workflows/feature_ci.yml | 4 ++-- .github/workflows/main_ci.yml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/code_coverage.yml b/.github/workflows/code_coverage.yml index 65fe607..9cf21df 100644 --- a/.github/workflows/code_coverage.yml +++ b/.github/workflows/code_coverage.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Create Build Environment run: cmake -E make_directory build diff --git a/.github/workflows/feature_ci.yml b/.github/workflows/feature_ci.yml index 9cee81e..6c6a2ab 100644 --- a/.github/workflows/feature_ci.yml +++ b/.github/workflows/feature_ci.yml @@ -40,7 +40,7 @@ jobs: runs-on: macos-14 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: ${{matrix.xcode}} @@ -68,7 +68,7 @@ jobs: runs-on: windows-2022 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Create Build Environment run: cmake -E make_directory build diff --git a/.github/workflows/main_ci.yml b/.github/workflows/main_ci.yml index dd74e82..f0cbc24 100644 --- a/.github/workflows/main_ci.yml +++ b/.github/workflows/main_ci.yml @@ -62,7 +62,7 @@ jobs: runs-on: macos-14 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: ${{matrix.xcode}} @@ -92,7 +92,7 @@ jobs: runs-on: windows-2022 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Create Build Environment run: cmake -E make_directory build From e379d5f05866a377e03e6f0776a9b40d5b4fc80c Mon Sep 17 00:00:00 2001 From: Martijn Courteaux Date: Fri, 2 May 2025 20:08:29 +0200 Subject: [PATCH 18/23] Do not use undefined preprocessor macros. (#186) This fixes a warning produced when using `-Wundef`. --- include/foonathan/memory/config.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/foonathan/memory/config.hpp b/include/foonathan/memory/config.hpp index 233caf6..25fe81f 100644 --- a/include/foonathan/memory/config.hpp +++ b/include/foonathan/memory/config.hpp @@ -35,7 +35,7 @@ // hosted implementation #ifndef FOONATHAN_HOSTED_IMPLEMENTATION -#if !_MSC_VER && !__STDC_HOSTED__ +#if !defined(_MSC_VER) && !defined(__STDC_HOSTED__) #define FOONATHAN_HOSTED_IMPLEMENTATION 0 #else #define FOONATHAN_HOSTED_IMPLEMENTATION 1 From 5540972527121cb2d51d0a59698cc591d18610d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Fri, 2 May 2025 12:09:31 -0600 Subject: [PATCH 19/23] Require less alignment in the default allocator unit tests Apparently, Android does not align the result properly. This should fix #176. --- test/default_allocator.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/default_allocator.cpp b/test/default_allocator.cpp index 6d2f91f..98774db 100644 --- a/test/default_allocator.cpp +++ b/test/default_allocator.cpp @@ -15,7 +15,7 @@ using namespace foonathan::memory; // *very* simple test case to ensure proper alignment and might catch some segfaults template -void check_default_allocator(Allocator& alloc, std::size_t def_alignment = detail::max_alignment) +void check_default_allocator(Allocator& alloc, std::size_t def_alignment = alignof(void*)) { auto ptr = alloc.allocate_node(1, 1); REQUIRE(detail::is_aligned(ptr, def_alignment)); @@ -76,8 +76,8 @@ TEST_CASE("virtual_memory_allocator") TEST_CASE("virtual_block_allocator") { - auto const page_size = get_virtual_memory_page_size(); - constexpr std::size_t no_blocks{8u}; + auto const page_size = get_virtual_memory_page_size(); + constexpr std::size_t no_blocks{8u}; virtual_block_allocator alloc{page_size, no_blocks}; auto block = alloc.allocate_block(); From f44fc035505f3acaf49b6ce2923ec217591ef866 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Fri, 2 May 2025 23:11:41 +0200 Subject: [PATCH 20/23] Fix `detail::alignment_for(size)` It must always be divisible by the size. --- src/detail/align.cpp | 5 +++-- test/detail/align.cpp | 18 ++++++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/detail/align.cpp b/src/detail/align.cpp index 79258ef..a0e942c 100644 --- a/src/detail/align.cpp +++ b/src/detail/align.cpp @@ -12,10 +12,11 @@ bool foonathan::memory::detail::is_aligned(void* ptr, std::size_t alignment) noe { FOONATHAN_MEMORY_ASSERT(is_valid_alignment(alignment)); auto address = reinterpret_cast(ptr); - return address % alignment == 0u; + return (address & (alignment - 1)) == 0u; } std::size_t foonathan::memory::detail::alignment_for(std::size_t size) noexcept { - return size >= max_alignment ? max_alignment : (std::size_t(1) << ilog2(size)); + auto largest_possible_alignment = size & ~(size - 1); + return largest_possible_alignment > max_alignment ? max_alignment : largest_possible_alignment; } diff --git a/test/detail/align.cpp b/test/detail/align.cpp index 9ad7c84..6399cc0 100644 --- a/test/detail/align.cpp +++ b/test/detail/align.cpp @@ -54,12 +54,18 @@ TEST_CASE("detail::alignment_for") static_assert(max_alignment >= 8, "test case not working"); REQUIRE(alignment_for(1) == 1); REQUIRE(alignment_for(2) == 2); - REQUIRE(alignment_for(3) == 2); + REQUIRE(alignment_for(3) == 1); REQUIRE(alignment_for(4) == 4); - REQUIRE(alignment_for(5) == 4); - REQUIRE(alignment_for(6) == 4); - REQUIRE(alignment_for(7) == 4); + REQUIRE(alignment_for(5) == 1); + REQUIRE(alignment_for(6) == 2); + REQUIRE(alignment_for(7) == 1); REQUIRE(alignment_for(8) == 8); - REQUIRE(alignment_for(9) == 8); - REQUIRE(alignment_for(100) == max_alignment); + REQUIRE(alignment_for(9) == 1); + REQUIRE(alignment_for(10) == 2); + REQUIRE(alignment_for(12) == 4); + REQUIRE(alignment_for(13) == 1); + REQUIRE(alignment_for(14) == 2); + REQUIRE(alignment_for(15) == 1); + REQUIRE(alignment_for(16) == max_alignment); + REQUIRE(alignment_for(1024) == max_alignment); } From bd799f101f4fefe962abb584e2c085f0b74611af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Fri, 2 May 2025 23:13:04 +0200 Subject: [PATCH 21/23] Ensure the container node size is always properly aligned for pointers Fixes #171. --- cmake/get_container_node_sizes.cmake | 2 +- include/foonathan/memory/detail/align.hpp | 9 ++++++++- .../memory/detail/container_node_sizes.hpp | 1 + test/detail/align.cpp | 15 +++++++++++++++ tool/node_size_debugger.cpp | 5 +++-- 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/cmake/get_container_node_sizes.cmake b/cmake/get_container_node_sizes.cmake index 90f220a..b314e5c 100644 --- a/cmake/get_container_node_sizes.cmake +++ b/cmake/get_container_node_sizes.cmake @@ -181,7 +181,7 @@ namespace detail template struct ${container}_node_size : std::integral_constant::value + sizeof(T)> + detail::round_up_to_multiple_of_alignment(detail::${container}_node_size::value + sizeof(T), alignof(void*))> {}; ") endforeach() diff --git a/include/foonathan/memory/detail/align.hpp b/include/foonathan/memory/detail/align.hpp index a9c0fd5..c29490d 100644 --- a/include/foonathan/memory/detail/align.hpp +++ b/include/foonathan/memory/detail/align.hpp @@ -21,6 +21,13 @@ namespace foonathan return alignment && (alignment & (alignment - 1)) == 0u; } + constexpr std::size_t round_up_to_multiple_of_alignment(std::size_t size, + std::size_t alignment) noexcept + { + FOONATHAN_MEMORY_ASSERT(is_valid_alignment(alignment)); + return (size + alignment - 1) & ~(alignment - 1); + } + // returns the offset needed to align ptr for given alignment // alignment must be valid inline std::size_t align_offset(std::uintptr_t address, std::size_t alignment) noexcept @@ -45,7 +52,7 @@ namespace foonathan // returns the minimum alignment required for a node of given size std::size_t alignment_for(std::size_t size) noexcept; } // namespace detail - } // namespace memory + } // namespace memory } // namespace foonathan #endif // FOONATHAN_MEMORY_DETAIL_ALIGN_HPP_INCLUDED diff --git a/include/foonathan/memory/detail/container_node_sizes.hpp b/include/foonathan/memory/detail/container_node_sizes.hpp index f2eef03..752d79c 100644 --- a/include/foonathan/memory/detail/container_node_sizes.hpp +++ b/include/foonathan/memory/detail/container_node_sizes.hpp @@ -4,6 +4,7 @@ #ifndef FOONATHAN_MEMORY_DETAIL_CONTAINER_NODE_SIZES_HPP_INCLUDED #define FOONATHAN_MEMORY_DETAIL_CONTAINER_NODE_SIZES_HPP_INCLUDED +#include "align.hpp" #include "container_node_sizes_impl.hpp" #endif //FOONATHAN_MEMORY_DETAIL_CONTAINER_NODE_SIZES_HPP_INCLUDED diff --git a/test/detail/align.cpp b/test/detail/align.cpp index 6399cc0..4a45a15 100644 --- a/test/detail/align.cpp +++ b/test/detail/align.cpp @@ -8,6 +8,21 @@ using namespace foonathan::memory; using namespace detail; +TEST_CASE("detail::round_up_to_multiple_of_alignment") +{ + REQUIRE(round_up_to_multiple_of_alignment(0, 1) == 0); + REQUIRE(round_up_to_multiple_of_alignment(1, 1) == 1); + REQUIRE(round_up_to_multiple_of_alignment(2, 1) == 2); + REQUIRE(round_up_to_multiple_of_alignment(3, 1) == 3); + REQUIRE(round_up_to_multiple_of_alignment(4, 1) == 4); + + REQUIRE(round_up_to_multiple_of_alignment(0, 2) == 0); + REQUIRE(round_up_to_multiple_of_alignment(1, 2) == 2); + REQUIRE(round_up_to_multiple_of_alignment(2, 2) == 2); + REQUIRE(round_up_to_multiple_of_alignment(3, 2) == 4); + REQUIRE(round_up_to_multiple_of_alignment(4, 2) == 4); +} + TEST_CASE("detail::align_offset") { auto ptr = reinterpret_cast(0); diff --git a/tool/node_size_debugger.cpp b/tool/node_size_debugger.cpp index 917fb3f..6ea183a 100644 --- a/tool/node_size_debugger.cpp +++ b/tool/node_size_debugger.cpp @@ -91,8 +91,9 @@ struct code_serializer out << "} // namespace detail" << newline << newline << "template " << newline << "struct " << struct_name(result.container_name) << newline << ": std::integral_constant::value + sizeof(T)>" << newline << "{};" << newline << newline; + << " detail::round_up_to_multiple_of_alignment(detail::" + << struct_name(result.container_name) << '<' << alignment + << ">::value + sizeof(T), alignof(void*))>" << newline << "{};" << newline << newline; } void suffix() const From 5a14184fc5ebb075321e3512a8aad049a3a6d523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Fri, 2 May 2025 15:27:53 -0600 Subject: [PATCH 22/23] Update copyright year/reformat --- CMakeLists.txt | 2 +- cmake/configuration.cmake | 2 +- example/CMakeLists.txt | 2 +- example/allocator_storage.cpp | 2 +- example/joint_allocation.cpp | 2 +- example/taking_allocators.cpp | 2 +- example/tracking.cpp | 2 +- example/using_allocators.cpp | 2 +- .../foonathan/memory/aligned_allocator.hpp | 2 +- .../foonathan/memory/allocator_storage.hpp | 10 ++++----- include/foonathan/memory/allocator_traits.hpp | 2 +- include/foonathan/memory/config.hpp | 2 +- include/foonathan/memory/container.hpp | 2 +- include/foonathan/memory/debugging.hpp | 2 +- .../foonathan/memory/default_allocator.hpp | 2 +- include/foonathan/memory/deleter.hpp | 2 +- include/foonathan/memory/detail/align.hpp | 2 +- include/foonathan/memory/detail/assert.hpp | 4 ++-- .../memory/detail/container_node_sizes.hpp | 2 +- .../foonathan/memory/detail/debug_helpers.hpp | 4 ++-- .../foonathan/memory/detail/ebo_storage.hpp | 4 ++-- include/foonathan/memory/detail/free_list.hpp | 4 ++-- .../memory/detail/free_list_array.hpp | 4 ++-- include/foonathan/memory/detail/ilog2.hpp | 4 ++-- .../memory/detail/lowlevel_allocator.hpp | 4 ++-- .../foonathan/memory/detail/memory_stack.hpp | 4 ++-- .../memory/detail/small_free_list.hpp | 4 ++-- include/foonathan/memory/detail/utility.hpp | 4 ++-- include/foonathan/memory/error.hpp | 7 +++---- .../foonathan/memory/fallback_allocator.hpp | 2 +- include/foonathan/memory/heap_allocator.hpp | 2 +- .../foonathan/memory/iteration_allocator.hpp | 2 +- include/foonathan/memory/joint_allocator.hpp | 2 +- include/foonathan/memory/malloc_allocator.hpp | 2 +- include/foonathan/memory/memory_arena.hpp | 4 ++-- include/foonathan/memory/memory_pool.hpp | 21 ++++++++++--------- .../memory/memory_pool_collection.hpp | 10 ++++----- include/foonathan/memory/memory_pool_type.hpp | 2 +- .../memory/memory_resource_adapter.hpp | 2 +- include/foonathan/memory/memory_stack.hpp | 2 +- include/foonathan/memory/namespace_alias.hpp | 2 +- include/foonathan/memory/new_allocator.hpp | 2 +- include/foonathan/memory/segregator.hpp | 2 +- include/foonathan/memory/smart_ptr.hpp | 2 +- include/foonathan/memory/static_allocator.hpp | 2 +- include/foonathan/memory/std_allocator.hpp | 2 +- .../foonathan/memory/temporary_allocator.hpp | 2 +- include/foonathan/memory/threading.hpp | 4 ++-- include/foonathan/memory/tracking.hpp | 4 ++-- include/foonathan/memory/virtual_memory.hpp | 2 +- src/CMakeLists.txt | 2 +- src/config.hpp.in | 2 +- src/debugging.cpp | 2 +- src/detail/align.cpp | 2 +- src/detail/assert.cpp | 2 +- src/detail/debug_helpers.cpp | 2 +- src/detail/free_list.cpp | 2 +- src/detail/free_list_array.cpp | 2 +- src/detail/free_list_utils.hpp | 4 ++-- src/detail/small_free_list.cpp | 2 +- src/error.cpp | 2 +- src/heap_allocator.cpp | 2 +- src/iteration_allocator.cpp | 2 +- src/malloc_allocator.cpp | 2 +- src/memory_arena.cpp | 2 +- src/memory_pool.cpp | 2 +- src/memory_pool_collection.cpp | 2 +- src/memory_stack.cpp | 2 +- src/new_allocator.cpp | 2 +- src/static_allocator.cpp | 2 +- src/temporary_allocator.cpp | 2 +- src/virtual_memory.cpp | 2 +- test/CMakeLists.txt | 2 +- test/aligned_allocator.cpp | 2 +- test/allocator_traits.cpp | 2 +- test/benchmark.hpp | 5 ++--- test/default_allocator.cpp | 2 +- test/detail/align.cpp | 2 +- test/detail/debug_helpers.cpp | 2 +- test/detail/free_list.cpp | 2 +- test/detail/free_list_array.cpp | 2 +- test/detail/ilog2.cpp | 2 +- test/detail/memory_stack.cpp | 2 +- test/fallback_allocator.cpp | 2 +- test/iteration_allocator.cpp | 2 +- test/joint_allocator.cpp | 2 +- test/memory_arena.cpp | 2 +- test/memory_pool.cpp | 2 +- test/memory_pool_collection.cpp | 2 +- test/memory_resource_adapter.cpp | 4 ++-- test/memory_stack.cpp | 2 +- test/profiling.cpp | 2 +- test/segregator.cpp | 2 +- test/smart_ptr.cpp | 2 +- test/test.cpp | 2 +- test/test_allocator.hpp | 2 +- tool/CMakeLists.txt | 2 +- tool/node_size_debugger.cpp | 2 +- tool/node_size_debugger.hpp | 2 +- tool/test_types.hpp | 2 +- 100 files changed, 136 insertions(+), 137 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7605795..4b0c720 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +# Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors # SPDX-License-Identifier: Zlib # root CMakeLists.txt, specifies option and interface library diff --git a/cmake/configuration.cmake b/cmake/configuration.cmake index 59f1d67..1145b44 100644 --- a/cmake/configuration.cmake +++ b/cmake/configuration.cmake @@ -1,4 +1,4 @@ -# Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +# Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors # SPDX-License-Identifier: Zlib # defines configuration options diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index e1442b3..47ab345 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +# Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors # SPDX-License-Identifier: Zlib # builds examples diff --git a/example/allocator_storage.cpp b/example/allocator_storage.cpp index fafde52..0337566 100644 --- a/example/allocator_storage.cpp +++ b/example/allocator_storage.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib // this example shows how to store allocators by reference and type-erased diff --git a/example/joint_allocation.cpp b/example/joint_allocation.cpp index b78f7bb..70f712b 100644 --- a/example/joint_allocation.cpp +++ b/example/joint_allocation.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib // this examples shows how to use the joint memory facilities diff --git a/example/taking_allocators.cpp b/example/taking_allocators.cpp index 542d5ce..439c8d3 100644 --- a/example/taking_allocators.cpp +++ b/example/taking_allocators.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib // this example provides two implementation of a deep_copy_ptr that performs a copy when copying the pointer diff --git a/example/tracking.cpp b/example/tracking.cpp index c8e7814..8bc54b6 100644 --- a/example/tracking.cpp +++ b/example/tracking.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib // this example shows how to track allocations diff --git a/example/using_allocators.cpp b/example/using_allocators.cpp index 5ac5760..5e70aab 100644 --- a/example/using_allocators.cpp +++ b/example/using_allocators.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib // this examples shows the basic usage of RawAllocator classes with containers and smart pointers diff --git a/include/foonathan/memory/aligned_allocator.hpp b/include/foonathan/memory/aligned_allocator.hpp index fe724aa..69c79af 100644 --- a/include/foonathan/memory/aligned_allocator.hpp +++ b/include/foonathan/memory/aligned_allocator.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_ALIGNED_ALLOCATOR_HPP_INCLUDED diff --git a/include/foonathan/memory/allocator_storage.hpp b/include/foonathan/memory/allocator_storage.hpp index 57f128a..0fe37fa 100644 --- a/include/foonathan/memory/allocator_storage.hpp +++ b/include/foonathan/memory/allocator_storage.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_ALLOCATOR_STORAGE_HPP_INCLUDED @@ -156,7 +156,7 @@ namespace foonathan allocator_storage& operator=(allocator_storage&& other) noexcept { - storage_policy:: operator=(detail::move(other)); + storage_policy::operator=(detail::move(other)); detail::mutex_storage>::operator=(detail::move(other)); return *this; @@ -803,9 +803,9 @@ namespace foonathan using traits = allocator_traits; using composable = is_composable_allocator; using storage = detail::reference_storage_impl< - typename allocator_traits::allocator_type, - decltype(detail::reference_type(typename allocator_traits< - RawAllocator>::is_stateful{}, + typename allocator_traits::allocator_type, + decltype(detail::reference_type(typename allocator_traits< + RawAllocator>::is_stateful{}, is_shared_allocator{}))>; public: diff --git a/include/foonathan/memory/allocator_traits.hpp b/include/foonathan/memory/allocator_traits.hpp index 78f5ccf..3cdda93 100644 --- a/include/foonathan/memory/allocator_traits.hpp +++ b/include/foonathan/memory/allocator_traits.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_ALLOCATOR_TRAITS_HPP_INCLUDED diff --git a/include/foonathan/memory/config.hpp b/include/foonathan/memory/config.hpp index 25fe81f..1754756 100644 --- a/include/foonathan/memory/config.hpp +++ b/include/foonathan/memory/config.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib /// \file diff --git a/include/foonathan/memory/container.hpp b/include/foonathan/memory/container.hpp index 5c77ddb..d5e3112 100644 --- a/include/foonathan/memory/container.hpp +++ b/include/foonathan/memory/container.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_CONTAINER_HPP_INCLUDED diff --git a/include/foonathan/memory/debugging.hpp b/include/foonathan/memory/debugging.hpp index bb9af98..b04166b 100644 --- a/include/foonathan/memory/debugging.hpp +++ b/include/foonathan/memory/debugging.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_DEBUGGING_HPP_INCLUDED diff --git a/include/foonathan/memory/default_allocator.hpp b/include/foonathan/memory/default_allocator.hpp index 4c213ff..f09f0e1 100644 --- a/include/foonathan/memory/default_allocator.hpp +++ b/include/foonathan/memory/default_allocator.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_DEFAULT_ALLOCATOR_HPP_INCLUDED diff --git a/include/foonathan/memory/deleter.hpp b/include/foonathan/memory/deleter.hpp index 75e99b0..64e1f97 100644 --- a/include/foonathan/memory/deleter.hpp +++ b/include/foonathan/memory/deleter.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_DELETER_HPP_INCLUDED diff --git a/include/foonathan/memory/detail/align.hpp b/include/foonathan/memory/detail/align.hpp index c29490d..8fcf426 100644 --- a/include/foonathan/memory/detail/align.hpp +++ b/include/foonathan/memory/detail/align.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_DETAIL_ALIGN_HPP_INCLUDED diff --git a/include/foonathan/memory/detail/assert.hpp b/include/foonathan/memory/detail/assert.hpp index dddbfbe..7317503 100644 --- a/include/foonathan/memory/detail/assert.hpp +++ b/include/foonathan/memory/detail/assert.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_DETAIL_ASSERT_HPP_INCLUDED @@ -49,7 +49,7 @@ namespace foonathan #define FOONATHAN_MEMORY_WARNING(Msg) #endif } // namespace detail - } // namespace memory + } // namespace memory } // namespace foonathan #endif // FOONATHAN_MEMORY_DETAIL_ASSERT_HPP_INCLUDED diff --git a/include/foonathan/memory/detail/container_node_sizes.hpp b/include/foonathan/memory/detail/container_node_sizes.hpp index 752d79c..d561a46 100644 --- a/include/foonathan/memory/detail/container_node_sizes.hpp +++ b/include/foonathan/memory/detail/container_node_sizes.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_DETAIL_CONTAINER_NODE_SIZES_HPP_INCLUDED diff --git a/include/foonathan/memory/detail/debug_helpers.hpp b/include/foonathan/memory/detail/debug_helpers.hpp index 3bdadb3..83e9e68 100644 --- a/include/foonathan/memory/detail/debug_helpers.hpp +++ b/include/foonathan/memory/detail/debug_helpers.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_DEBUG_HELPERS_HPP_INCLUDED @@ -228,7 +228,7 @@ namespace foonathan using default_leak_checker = no_leak_checker; #endif } // namespace detail - } // namespace memory + } // namespace memory } // namespace foonathan #endif // FOONATHAN_MEMORY_DEBUG_HELPERS_HPP_INCLUDED diff --git a/include/foonathan/memory/detail/ebo_storage.hpp b/include/foonathan/memory/detail/ebo_storage.hpp index 35ccf1e..79c4316 100644 --- a/include/foonathan/memory/detail/ebo_storage.hpp +++ b/include/foonathan/memory/detail/ebo_storage.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_DETAIL_EBO_STORAGE_HPP_INCLUDED @@ -35,7 +35,7 @@ namespace foonathan } }; } // namespace detail - } // namespace memory + } // namespace memory } // namespace foonathan #endif // FOONATHAN_MEMORY_DETAIL_EBO_STORAGE_HPP_INCLUDED diff --git a/include/foonathan/memory/detail/free_list.hpp b/include/foonathan/memory/detail/free_list.hpp index cd646e1..81e29ac 100644 --- a/include/foonathan/memory/detail/free_list.hpp +++ b/include/foonathan/memory/detail/free_list.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_DETAILL_FREE_LIST_HPP_INCLUDED @@ -221,7 +221,7 @@ namespace foonathan using array_free_memory_list = ordered_free_memory_list; #endif } // namespace detail - } // namespace memory + } // namespace memory } // namespace foonathan #endif // FOONATHAN_MEMORY_DETAILL_FREE_LIST_HPP_INCLUDED diff --git a/include/foonathan/memory/detail/free_list_array.hpp b/include/foonathan/memory/detail/free_list_array.hpp index c18b46b..322015e 100644 --- a/include/foonathan/memory/detail/free_list_array.hpp +++ b/include/foonathan/memory/detail/free_list_array.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_DETAIL_FREE_LIST_ARRAY_HPP @@ -119,7 +119,7 @@ namespace foonathan static std::size_t size_from_index(std::size_t index) noexcept; }; } // namespace detail - } // namespace memory + } // namespace memory } // namespace foonathan #endif //FOONATHAN_MEMORY_DETAIL_FREE_LIST_ARRAY_HPP diff --git a/include/foonathan/memory/detail/ilog2.hpp b/include/foonathan/memory/detail/ilog2.hpp index 0d98e46..88f117e 100644 --- a/include/foonathan/memory/detail/ilog2.hpp +++ b/include/foonathan/memory/detail/ilog2.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_DETAIL_ILOG2_HPP_INCLUDED @@ -62,7 +62,7 @@ namespace foonathan return ilog2_base(x) - std::size_t(is_power_of_two(x)); } } // namespace detail - } // namespace memory + } // namespace memory } // namespace foonathan #endif diff --git a/include/foonathan/memory/detail/lowlevel_allocator.hpp b/include/foonathan/memory/detail/lowlevel_allocator.hpp index 5836219..7e339b2 100644 --- a/include/foonathan/memory/detail/lowlevel_allocator.hpp +++ b/include/foonathan/memory/detail/lowlevel_allocator.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_DETAIL_LOWLEVEL_ALLOCATOR_HPP_INCLUDED @@ -79,7 +79,7 @@ namespace foonathan #define FOONATHAN_MEMORY_LL_ALLOCATOR_LEAK_CHECKER(functor, var_name) \ FOONATHAN_MEMORY_GLOBAL_LEAK_CHECKER(lowlevel_allocator_leak_handler, var_name) } // namespace detail - } // namespace memory + } // namespace memory } // namespace foonathan #endif // FOONATHAN_MEMORY_DETAIL_LOWLEVEL_ALLOCATOR_HPP_INCLUDED diff --git a/include/foonathan/memory/detail/memory_stack.hpp b/include/foonathan/memory/detail/memory_stack.hpp index 7fbe447..1cf22db 100644 --- a/include/foonathan/memory/detail/memory_stack.hpp +++ b/include/foonathan/memory/detail/memory_stack.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_DETAIL_MEMORY_STACK_HPP_INCLUDED @@ -113,7 +113,7 @@ namespace foonathan char* cur_; }; } // namespace detail - } // namespace memory + } // namespace memory } // namespace foonathan #endif // FOONATHAN_MEMORY_DETAIL_MEMORY_STACK_HPP_INCLUDED diff --git a/include/foonathan/memory/detail/small_free_list.hpp b/include/foonathan/memory/detail/small_free_list.hpp index 60bde31..c2c1cd2 100644 --- a/include/foonathan/memory/detail/small_free_list.hpp +++ b/include/foonathan/memory/detail/small_free_list.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_DETAIL_SMALL_FREE_LIST_HPP_INCLUDED @@ -157,7 +157,7 @@ namespace foonathan // for some reason, this is required in order to define it void swap(small_free_memory_list& a, small_free_memory_list& b) noexcept; } // namespace detail - } // namespace memory + } // namespace memory } // namespace foonathan #endif // FOONATHAN_MEMORY_DETAIL_SMALL_FREE_LIST_HPP_INCLUDED diff --git a/include/foonathan/memory/detail/utility.hpp b/include/foonathan/memory/detail/utility.hpp index f76dd3c..188e9d8 100644 --- a/include/foonathan/memory/detail/utility.hpp +++ b/include/foonathan/memory/detail/utility.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_DETAIL_UTILITY_HPP @@ -111,7 +111,7 @@ namespace foonathan { }; } // namespace detail - } // namespace memory + } // namespace memory } // namespace foonathan #endif //FOONATHAN_MEMORY_DETAIL_UTILITY_HPP diff --git a/include/foonathan/memory/error.hpp b/include/foonathan/memory/error.hpp index d3152dc..90e4736 100644 --- a/include/foonathan/memory/error.hpp +++ b/include/foonathan/memory/error.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib /// \file @@ -278,11 +278,10 @@ namespace foonathan void check_allocation_size(std::size_t passed, std::size_t supported, const allocator_info& info) { - check_allocation_size( - passed, [&] { return supported; }, info); + check_allocation_size(passed, [&] { return supported; }, info); } } // namespace detail - } // namespace memory + } // namespace memory } // namespace foonathan #endif // FOONATHAN_MEMORY_ERROR_HPP_INCLUDED diff --git a/include/foonathan/memory/fallback_allocator.hpp b/include/foonathan/memory/fallback_allocator.hpp index 7ae86ea..9a94040 100644 --- a/include/foonathan/memory/fallback_allocator.hpp +++ b/include/foonathan/memory/fallback_allocator.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_FALLBACK_ALLOCATOR_HPP_INCLUDED diff --git a/include/foonathan/memory/heap_allocator.hpp b/include/foonathan/memory/heap_allocator.hpp index 87532c4..ef4fd1f 100644 --- a/include/foonathan/memory/heap_allocator.hpp +++ b/include/foonathan/memory/heap_allocator.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_HEAP_ALLOCATOR_HPP_INCLUDED diff --git a/include/foonathan/memory/iteration_allocator.hpp b/include/foonathan/memory/iteration_allocator.hpp index 37cb4cc..d38cf20 100644 --- a/include/foonathan/memory/iteration_allocator.hpp +++ b/include/foonathan/memory/iteration_allocator.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_ITERATION_ALLOCATOR_HPP_INCLUDED diff --git a/include/foonathan/memory/joint_allocator.hpp b/include/foonathan/memory/joint_allocator.hpp index 377bc81..18333c5 100644 --- a/include/foonathan/memory/joint_allocator.hpp +++ b/include/foonathan/memory/joint_allocator.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_JOINT_ALLOCATOR_HPP_INCLUDED diff --git a/include/foonathan/memory/malloc_allocator.hpp b/include/foonathan/memory/malloc_allocator.hpp index ef8a1b0..e1a084b 100644 --- a/include/foonathan/memory/malloc_allocator.hpp +++ b/include/foonathan/memory/malloc_allocator.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_MALLOC_ALLOCATOR_HPP_INCLUDED diff --git a/include/foonathan/memory/memory_arena.hpp b/include/foonathan/memory/memory_arena.hpp index 4c277d8..30ddd68 100644 --- a/include/foonathan/memory/memory_arena.hpp +++ b/include/foonathan/memory/memory_arena.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_MEMORY_ARENA_HPP_INCLUDED @@ -686,7 +686,7 @@ namespace foonathan return std::size_t(value * 1000 * 1000 * 1000); } } // namespace literals - } // namespace memory + } // namespace memory } // namespace foonathan #endif // FOONATHAN_MEMORY_MEMORY_ARENA_HPP_INCLUDED diff --git a/include/foonathan/memory/memory_pool.hpp b/include/foonathan/memory/memory_pool.hpp index a7e5961..0410788 100644 --- a/include/foonathan/memory/memory_pool.hpp +++ b/include/foonathan/memory/memory_pool.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_MEMORY_POOL_HPP_INCLUDED @@ -222,11 +222,12 @@ namespace foonathan return arena_.get_allocator(); } - /// \returns If `ptr` is in memory owned by the underlying arena. - bool owns(const void* ptr) const noexcept - { - return arena_.owns(ptr); - } + /// \returns If `ptr` is in memory owned by the underlying arena. + bool owns(const void* ptr) const noexcept + { + return arena_.owns(ptr); + } + private: allocator_info info() const noexcept { @@ -301,8 +302,8 @@ namespace foonathan { detail::check_allocation_size(size, max_node_size(state), state.info()); - detail::check_allocation_size( - alignment, [&] { return max_alignment(state); }, state.info()); + detail::check_allocation_size< + bad_alignment>(alignment, [&] { return max_alignment(state); }, state.info()); auto mem = state.allocate_node(); state.on_allocate(size); return mem; @@ -319,8 +320,8 @@ namespace foonathan { detail::check_allocation_size(size, max_node_size(state), state.info()); - detail::check_allocation_size( - alignment, [&] { return max_alignment(state); }, state.info()); + detail::check_allocation_size< + bad_alignment>(alignment, [&] { return max_alignment(state); }, state.info()); detail::check_allocation_size(count * size, max_array_size(state), state.info()); auto mem = state.allocate_array(count, size); diff --git a/include/foonathan/memory/memory_pool_collection.hpp b/include/foonathan/memory/memory_pool_collection.hpp index c76b4e8..be7b7e5 100644 --- a/include/foonathan/memory/memory_pool_collection.hpp +++ b/include/foonathan/memory/memory_pool_collection.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_MEMORY_POOL_COLLECTION_HPP_INCLUDED @@ -125,8 +125,8 @@ namespace foonathan /// \throws Anything thrown by the \concept{concept_blockallocator,BlockAllocator} if a growth is needed or a \ref bad_node_size exception if the node size is too big. void* allocate_node(std::size_t node_size) { - detail::check_allocation_size( - node_size, [&] { return max_node_size(); }, info()); + detail::check_allocation_size< + bad_node_size>(node_size, [&] { return max_node_size(); }, info()); auto& pool = pools_.get(node_size); if (pool.empty()) { @@ -169,8 +169,8 @@ namespace foonathan /// \c node_size must be valid \concept{concept_node,node size}. void* allocate_array(std::size_t count, std::size_t node_size) { - detail::check_allocation_size( - node_size, [&] { return max_node_size(); }, info()); + detail::check_allocation_size< + bad_node_size>(node_size, [&] { return max_node_size(); }, info()); auto& pool = pools_.get(node_size); diff --git a/include/foonathan/memory/memory_pool_type.hpp b/include/foonathan/memory/memory_pool_type.hpp index 714edea..c5cf2e5 100644 --- a/include/foonathan/memory/memory_pool_type.hpp +++ b/include/foonathan/memory/memory_pool_type.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_MEMORY_POOL_TYPE_HPP_INCLUDED diff --git a/include/foonathan/memory/memory_resource_adapter.hpp b/include/foonathan/memory/memory_resource_adapter.hpp index 7ff48f1..4fad726 100644 --- a/include/foonathan/memory/memory_resource_adapter.hpp +++ b/include/foonathan/memory/memory_resource_adapter.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_MEMORY_RESOURCE_ADAPTER_HPP_INCLUDED diff --git a/include/foonathan/memory/memory_stack.hpp b/include/foonathan/memory/memory_stack.hpp index b3dcd0f..b4a0234 100644 --- a/include/foonathan/memory/memory_stack.hpp +++ b/include/foonathan/memory/memory_stack.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_MEMORY_STACK_HPP_INCLUDED diff --git a/include/foonathan/memory/namespace_alias.hpp b/include/foonathan/memory/namespace_alias.hpp index a3e0354..50caeca 100644 --- a/include/foonathan/memory/namespace_alias.hpp +++ b/include/foonathan/memory/namespace_alias.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_NAMESPACE_ALIAS_HPP_INCLUDED diff --git a/include/foonathan/memory/new_allocator.hpp b/include/foonathan/memory/new_allocator.hpp index 61fb5db..73c3c7c 100644 --- a/include/foonathan/memory/new_allocator.hpp +++ b/include/foonathan/memory/new_allocator.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_NEW_ALLOCATOR_HPP_INCLUDED diff --git a/include/foonathan/memory/segregator.hpp b/include/foonathan/memory/segregator.hpp index 80e066b..101b82a 100644 --- a/include/foonathan/memory/segregator.hpp +++ b/include/foonathan/memory/segregator.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_SEGREGATOR_HPP_INCLUDED diff --git a/include/foonathan/memory/smart_ptr.hpp b/include/foonathan/memory/smart_ptr.hpp index 9964495..e4f3f02 100644 --- a/include/foonathan/memory/smart_ptr.hpp +++ b/include/foonathan/memory/smart_ptr.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_SMART_PTR_HPP_INCLUDED diff --git a/include/foonathan/memory/static_allocator.hpp b/include/foonathan/memory/static_allocator.hpp index 17552b4..19fc208 100644 --- a/include/foonathan/memory/static_allocator.hpp +++ b/include/foonathan/memory/static_allocator.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_STATIC_ALLOCATOR_HPP_INCLUDED diff --git a/include/foonathan/memory/std_allocator.hpp b/include/foonathan/memory/std_allocator.hpp index e865915..d31d449 100644 --- a/include/foonathan/memory/std_allocator.hpp +++ b/include/foonathan/memory/std_allocator.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_STD_ALLOCATOR_HPP_INCLUDED diff --git a/include/foonathan/memory/temporary_allocator.hpp b/include/foonathan/memory/temporary_allocator.hpp index 3b6269d..292a2d1 100644 --- a/include/foonathan/memory/temporary_allocator.hpp +++ b/include/foonathan/memory/temporary_allocator.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_TEMPORARY_ALLOCATOR_HPP_INCLUDED diff --git a/include/foonathan/memory/threading.hpp b/include/foonathan/memory/threading.hpp index 4cf507c..059e3b4 100644 --- a/include/foonathan/memory/threading.hpp +++ b/include/foonathan/memory/threading.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_THREADING_HPP_INCLUDED @@ -148,7 +148,7 @@ namespace foonathan return {a, m}; } } // namespace detail - } // namespace memory + } // namespace memory } // namespace foonathan #endif // FOONATHAN_MEMORY_THREADING_HPP_INCLUDED diff --git a/include/foonathan/memory/tracking.hpp b/include/foonathan/memory/tracking.hpp index 57fb0d1..f815b5d 100644 --- a/include/foonathan/memory/tracking.hpp +++ b/include/foonathan/memory/tracking.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_TRACKING_HPP_INCLUDED @@ -213,7 +213,7 @@ namespace foonathan tracked_allocator& operator=(tracked_allocator&& other) noexcept { - tracker:: operator=(detail::move(other)); + tracker::operator=(detail::move(other)); allocator_type::operator=(detail::move(other)); detail::set_tracker(0, get_allocator(), &get_tracker()); return *this; diff --git a/include/foonathan/memory/virtual_memory.hpp b/include/foonathan/memory/virtual_memory.hpp index 73f11e8..a5d1662 100644 --- a/include/foonathan/memory/virtual_memory.hpp +++ b/include/foonathan/memory/virtual_memory.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_VIRTUAL_MEMORY_HPP_INCLUDED diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7501be2..e736ae5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +# Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors # SPDX-License-Identifier: Zlib # builds actual library diff --git a/src/config.hpp.in b/src/config.hpp.in index b541a57..34cffcb 100644 --- a/src/config.hpp.in +++ b/src/config.hpp.in @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_IMPL_IN_CONFIG_HPP diff --git a/src/debugging.cpp b/src/debugging.cpp index d7caa56..b7f8a20 100644 --- a/src/debugging.cpp +++ b/src/debugging.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "debugging.hpp" diff --git a/src/detail/align.cpp b/src/detail/align.cpp index a0e942c..293ad77 100644 --- a/src/detail/align.cpp +++ b/src/detail/align.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "detail/align.hpp" diff --git a/src/detail/assert.cpp b/src/detail/assert.cpp index 91ddd2e..bbb973c 100644 --- a/src/detail/assert.cpp +++ b/src/detail/assert.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "detail/assert.hpp" diff --git a/src/detail/debug_helpers.cpp b/src/detail/debug_helpers.cpp index 65b998a..0082f2d 100644 --- a/src/detail/debug_helpers.cpp +++ b/src/detail/debug_helpers.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "detail/debug_helpers.hpp" diff --git a/src/detail/free_list.cpp b/src/detail/free_list.cpp index ebf494c..f7c2c78 100644 --- a/src/detail/free_list.cpp +++ b/src/detail/free_list.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "detail/free_list.hpp" diff --git a/src/detail/free_list_array.cpp b/src/detail/free_list_array.cpp index 907f795..943d3d1 100644 --- a/src/detail/free_list_array.cpp +++ b/src/detail/free_list_array.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "detail/free_list_array.hpp" diff --git a/src/detail/free_list_utils.hpp b/src/detail/free_list_utils.hpp index bffee4d..fa42c0f 100644 --- a/src/detail/free_list_utils.hpp +++ b/src/detail/free_list_utils.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_SRC_DETAIL_FREE_LIST_UTILS_HPP_INCLUDED @@ -142,7 +142,7 @@ namespace foonathan return a == b || greater(a, b); } } // namespace detail - } // namespace memory + } // namespace memory } // namespace foonathan #endif // FOONATHAN_MEMORY_SRC_DETAIL_FREE_LIST_UTILS_HPP_INCLUDED diff --git a/src/detail/small_free_list.cpp b/src/detail/small_free_list.cpp index 1967b74..7bebed3 100644 --- a/src/detail/small_free_list.cpp +++ b/src/detail/small_free_list.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "detail/small_free_list.hpp" diff --git a/src/error.cpp b/src/error.cpp index 53adece..f814d1d 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "error.hpp" diff --git a/src/heap_allocator.cpp b/src/heap_allocator.cpp index 81c91d4..4ecd4f6 100644 --- a/src/heap_allocator.cpp +++ b/src/heap_allocator.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "heap_allocator.hpp" diff --git a/src/iteration_allocator.cpp b/src/iteration_allocator.cpp index 06194e8..5cd63c5 100644 --- a/src/iteration_allocator.cpp +++ b/src/iteration_allocator.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "iteration_allocator.hpp" diff --git a/src/malloc_allocator.cpp b/src/malloc_allocator.cpp index 8e70c03..fbe7668 100644 --- a/src/malloc_allocator.cpp +++ b/src/malloc_allocator.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "config.hpp" diff --git a/src/memory_arena.cpp b/src/memory_arena.cpp index 44edd1a..80294ef 100644 --- a/src/memory_arena.cpp +++ b/src/memory_arena.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "memory_arena.hpp" diff --git a/src/memory_pool.cpp b/src/memory_pool.cpp index 0159f5d..ed522bb 100644 --- a/src/memory_pool.cpp +++ b/src/memory_pool.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "memory_pool.hpp" diff --git a/src/memory_pool_collection.cpp b/src/memory_pool_collection.cpp index bd04746..b7afe44 100644 --- a/src/memory_pool_collection.cpp +++ b/src/memory_pool_collection.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "memory_pool_collection.hpp" diff --git a/src/memory_stack.cpp b/src/memory_stack.cpp index 36a6c73..374fe1a 100644 --- a/src/memory_stack.cpp +++ b/src/memory_stack.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "memory_stack.hpp" diff --git a/src/new_allocator.cpp b/src/new_allocator.cpp index 80dcc3f..8286e56 100644 --- a/src/new_allocator.cpp +++ b/src/new_allocator.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "new_allocator.hpp" diff --git a/src/static_allocator.cpp b/src/static_allocator.cpp index b309d29..c8f1733 100644 --- a/src/static_allocator.cpp +++ b/src/static_allocator.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "static_allocator.hpp" diff --git a/src/temporary_allocator.cpp b/src/temporary_allocator.cpp index 77e4672..cd1ae03 100644 --- a/src/temporary_allocator.cpp +++ b/src/temporary_allocator.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "temporary_allocator.hpp" diff --git a/src/virtual_memory.cpp b/src/virtual_memory.cpp index 8be7a52..7c8ca00 100644 --- a/src/virtual_memory.cpp +++ b/src/virtual_memory.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "virtual_memory.hpp" diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index caf8eb3..787dc61 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +# Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors # SPDX-License-Identifier: Zlib # builds test diff --git a/test/aligned_allocator.cpp b/test/aligned_allocator.cpp index 125ae70..05ee1f4 100644 --- a/test/aligned_allocator.cpp +++ b/test/aligned_allocator.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "aligned_allocator.hpp" diff --git a/test/allocator_traits.cpp b/test/allocator_traits.cpp index 1b66b1b..4b253da 100644 --- a/test/allocator_traits.cpp +++ b/test/allocator_traits.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "allocator_traits.hpp" diff --git a/test/benchmark.hpp b/test/benchmark.hpp index 1346329..969e2d7 100644 --- a/test/benchmark.hpp +++ b/test/benchmark.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_TEST_BENCHMARK_HPP_INCLUDED @@ -172,8 +172,7 @@ struct butterfly : basic_bulk { butterfly(std::size_t c) : basic_bulk([](std::vector& ptrs) - { std::shuffle(ptrs.begin(), ptrs.end(), std::mt19937{}); }, - c) + { std::shuffle(ptrs.begin(), ptrs.end(), std::mt19937{}); }, c) { } diff --git a/test/default_allocator.cpp b/test/default_allocator.cpp index 98774db..d31e540 100644 --- a/test/default_allocator.cpp +++ b/test/default_allocator.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib // tests all possible default allocator classes diff --git a/test/detail/align.cpp b/test/detail/align.cpp index 4a45a15..c60dfcc 100644 --- a/test/detail/align.cpp +++ b/test/detail/align.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "detail/align.hpp" diff --git a/test/detail/debug_helpers.cpp b/test/detail/debug_helpers.cpp index 847f5c3..a1d7b3c 100644 --- a/test/detail/debug_helpers.cpp +++ b/test/detail/debug_helpers.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "detail/debug_helpers.hpp" diff --git a/test/detail/free_list.cpp b/test/detail/free_list.cpp index f7f7e41..214b536 100644 --- a/test/detail/free_list.cpp +++ b/test/detail/free_list.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "detail/free_list.hpp" diff --git a/test/detail/free_list_array.cpp b/test/detail/free_list_array.cpp index 0e14f20..b404c82 100644 --- a/test/detail/free_list_array.cpp +++ b/test/detail/free_list_array.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "detail/free_list_array.hpp" diff --git a/test/detail/ilog2.cpp b/test/detail/ilog2.cpp index 584f644..83db8ba 100644 --- a/test/detail/ilog2.cpp +++ b/test/detail/ilog2.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "detail/ilog2.hpp" diff --git a/test/detail/memory_stack.cpp b/test/detail/memory_stack.cpp index da1ffc7..5d322f5 100644 --- a/test/detail/memory_stack.cpp +++ b/test/detail/memory_stack.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "detail/memory_stack.hpp" diff --git a/test/fallback_allocator.cpp b/test/fallback_allocator.cpp index d3278a5..878648b 100644 --- a/test/fallback_allocator.cpp +++ b/test/fallback_allocator.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "fallback_allocator.hpp" diff --git a/test/iteration_allocator.cpp b/test/iteration_allocator.cpp index f5a80d8..50f79aa 100644 --- a/test/iteration_allocator.cpp +++ b/test/iteration_allocator.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "iteration_allocator.hpp" diff --git a/test/joint_allocator.cpp b/test/joint_allocator.cpp index 5c3f4a2..1e33126 100644 --- a/test/joint_allocator.cpp +++ b/test/joint_allocator.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "joint_allocator.hpp" diff --git a/test/memory_arena.cpp b/test/memory_arena.cpp index a054963..41b4b00 100644 --- a/test/memory_arena.cpp +++ b/test/memory_arena.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "memory_arena.hpp" diff --git a/test/memory_pool.cpp b/test/memory_pool.cpp index f043c75..6c980d3 100644 --- a/test/memory_pool.cpp +++ b/test/memory_pool.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "memory_pool.hpp" diff --git a/test/memory_pool_collection.cpp b/test/memory_pool_collection.cpp index 73bc81c..ad6e456 100644 --- a/test/memory_pool_collection.cpp +++ b/test/memory_pool_collection.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "memory_pool_collection.hpp" diff --git a/test/memory_resource_adapter.cpp b/test/memory_resource_adapter.cpp index 4f01f8b..5a982f1 100644 --- a/test/memory_resource_adapter.cpp +++ b/test/memory_resource_adapter.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "memory_resource_adapter.hpp" @@ -24,7 +24,7 @@ struct pmr_test_allocator void* allocate_array(std::size_t n, std::size_t size, std::size_t) { array_allocated += n * size; - return ::operator new(n* size); + return ::operator new(n * size); } void deallocate_node(void* p, std::size_t size, std::size_t) diff --git a/test/memory_stack.cpp b/test/memory_stack.cpp index e519ab5..35f5534 100644 --- a/test/memory_stack.cpp +++ b/test/memory_stack.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "memory_stack.hpp" diff --git a/test/profiling.cpp b/test/profiling.cpp index b50db5b..823d58d 100644 --- a/test/profiling.cpp +++ b/test/profiling.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib // Profiling code to check performance of allocators. diff --git a/test/segregator.cpp b/test/segregator.cpp index 70b3434..1d9fffe 100644 --- a/test/segregator.cpp +++ b/test/segregator.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "segregator.hpp" diff --git a/test/smart_ptr.cpp b/test/smart_ptr.cpp index ba98c88..7c273b3 100644 --- a/test/smart_ptr.cpp +++ b/test/smart_ptr.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include "smart_ptr.hpp" diff --git a/test/test.cpp b/test/test.cpp index 4319e6f..7e806cc 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN diff --git a/test/test_allocator.hpp b/test/test_allocator.hpp index df17666..53d4d4e 100644 --- a/test/test_allocator.hpp +++ b/test/test_allocator.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_TEST_TEST_ALLOCATOR_HPP diff --git a/tool/CMakeLists.txt b/tool/CMakeLists.txt index 4a231d8..60e188d 100644 --- a/tool/CMakeLists.txt +++ b/tool/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +# Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors # SPDX-License-Identifier: Zlib # builds tools diff --git a/tool/node_size_debugger.cpp b/tool/node_size_debugger.cpp index 6ea183a..43e82ab 100644 --- a/tool/node_size_debugger.cpp +++ b/tool/node_size_debugger.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #include diff --git a/tool/node_size_debugger.hpp b/tool/node_size_debugger.hpp index a9db2ce..8ee32bb 100644 --- a/tool/node_size_debugger.hpp +++ b/tool/node_size_debugger.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_TOOL_NODE_SIZE_DEBUGGER_HPP diff --git a/tool/test_types.hpp b/tool/test_types.hpp index c2c50c7..801a215 100644 --- a/tool/test_types.hpp +++ b/tool/test_types.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors +// Copyright (C) 2015-2025 Jonathan Müller and foonathan/memory contributors // SPDX-License-Identifier: Zlib #ifndef FOONATHAN_MEMORY_TOOL_TEST_TYPES_HPP_INCLUDED From 79d054caaa491d9b6ed7cc65a3a84b495578e6c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Fri, 2 May 2025 15:37:14 -0600 Subject: [PATCH 23/23] Release 0.7-4 --- CHANGELOG.md | 24 ++++++++++++++++++++++++ CMakeLists.txt | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aead972..604900a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,29 @@ # Upcoming Changes +# 0.7-4 + +CMake Improvements: + +* Fix deprecation warnings, update doctest, and CI. (#188) +* Remove static linking for cross compilation. (#162, #164) +* Fix include paths, cache variables. (#165, #190) +* Assume `thread_local` is supported. (#167) + +Bugfixes: + +* Support `fixed_block_allocator` in `memory_pool_collection`. (#173) +* Fix `virtual_block_allocator` deallocation. (#175) +* Fix `std::shared_ptr` node size alignment mismatch. (#171) +* Fix unit tests on android. (#176) +* Don't use undefined preprocessor macros. (#186) +* Fix unused variable warnings. (#183, #184, #189) + +Improvements: + +* Allow incomplete types in `allocator_deallocator`. (#153) +* Give `allocator_polymorphic_deallocator/deleter` a default constructor. (#155) +* Expose `memory_pool::owns`. (#174) + # 0.7-3 CMake improvements: diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b0c720..89e3e90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ project(FOONATHAN_MEMORY) set(FOONATHAN_MEMORY_VERSION_MAJOR 0 CACHE STRING "major version of memory" FORCE) set(FOONATHAN_MEMORY_VERSION_MINOR 7 CACHE STRING "minor version of memory" FORCE) -set(FOONATHAN_MEMORY_VERSION_PATCH 3 CACHE STRING "patch version of memory" FORCE) +set(FOONATHAN_MEMORY_VERSION_PATCH 4 CACHE STRING "patch version of memory" FORCE) set(FOONATHAN_MEMORY_VERSION "$CACHE{FOONATHAN_MEMORY_VERSION_MAJOR}.$CACHE{FOONATHAN_MEMORY_VERSION_MINOR}.$CACHE{FOONATHAN_MEMORY_VERSION_PATCH}" CACHE STRING "version of memory" FORCE)