vecmem 1.14.0
Loading...
Searching...
No Matches
arena_memory_resource.hpp
1/*
2 * VecMem project, part of the ACTS project (R&D line)
3 *
4 * (c) 2021-2023 CERN for the benefit of the ACTS project
5 *
6 * Mozilla Public License Version 2.0
7 */
8
9#pragma once
10
11// Local include(s).
12#include "vecmem/memory/details/memory_resource_base.hpp"
13#include "vecmem/memory/memory_resource.hpp"
14#include "vecmem/vecmem_core_export.hpp"
15
16// System include(s).
17#include <memory>
18
19namespace vecmem {
20
21// Forward declaration(s).
22namespace details {
23class arena_memory_resource_impl;
24}
25
28
29public:
39 arena_memory_resource(memory_resource& upstream, std::size_t initial_size,
40 std::size_t maximum_size);
46
50
56
57private:
60
63 virtual void* do_allocate(std::size_t bytes, std::size_t) override final;
66 virtual void do_deallocate(void* p, std::size_t bytes,
67 std::size_t) override final;
68
70
72 std::unique_ptr<details::arena_memory_resource_impl> m_impl;
73
74}; // class arena_memory_resource
75
76} // namespace vecmem
Memory resource implementing an arena allocation scheme.
Definition arena_memory_resource.hpp:27
arena_memory_resource(const arena_memory_resource &)=delete
Disallow copying the memory resource.
VECMEM_CORE_EXPORT arena_memory_resource & operator=(arena_memory_resource &&rhs)
Move assignment operator.
virtual VECMEM_CORE_EXPORT void * do_allocate(std::size_t bytes, std::size_t) override final
Allocate memory in the arena.
virtual VECMEM_CORE_EXPORT void do_deallocate(void *p, std::size_t bytes, std::size_t) override final
De-allocate a previously allocated memory block.
VECMEM_CORE_EXPORT arena_memory_resource(arena_memory_resource &&parent)
Move constructor.
arena_memory_resource & operator=(const arena_memory_resource &)=delete
Disallow copying the memory resource.
VECMEM_CORE_EXPORT ~arena_memory_resource()
Destructor.
Base class for implementations of the vecmem::memory_resource interface.
Definition memory_resource_base.hpp:25
Main namespace for the vecmem classes/functions.
Definition atomic_ref.hpp:16
std::vector< T, vecmem::polymorphic_allocator< T > > vector
Alias type for vectors with our polymorphic allocator.
Definition vector.hpp:35