ATLAS Offline Software
Loading...
Searching...
No Matches
ArenaBlockAllocatorBase.h
Go to the documentation of this file.
1// This file's extension implies that it's C, but it's really -*- C++ -*-.
2/*
3 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
4*/
11
12
13#ifndef ATHALLOCATORS_ARENABLOCKALLOCATORBASE_H
14#define ATHALLOCATORS_ARENABLOCKALLOCATORBASE_H
15
16
18
19
20namespace SG {
21
22
23class ArenaBlock;
24
25
34 : public ArenaAllocatorBase
35{
36public:
43
44
49
50
54
55
60
61
66
67
71 void swap (ArenaBlockAllocatorBase& other);
72
73
74
92 virtual void reserve (size_t size) override;
93
94
103 virtual void erase() override;
104
105
109 virtual Stats stats() const override;
110
111
115 virtual const std::string& name() const override;
116
117
121 const Params& params() const;
122
123
130 void protect();
131
132
139 void unprotect();
140
141
142protected:
148
149
155 void eraseUnprotected();
156
159
162
165
168
171};
172
173
174} // namespace SG
175
176
177#endif // not ATHALLOCATORS_ARENABLOCKALLOCATORBASE_H
Common base class for arena allocator classes. See Arena.h for an overview of the arena-based memory ...
Common base class for arena allocator classes.
virtual void reserve(size_t size) override
Set the total number of elements cached by the allocator.
void unprotect()
Write-enable the memory managed by this allocator.
ArenaBlockAllocatorBase(const ArenaBlockAllocatorBase &)=delete
Don't allow copy construction or assignment.
const Params & params() const
Return this Allocator's parameters.
ArenaBlock * getBlock()
Return an empty block, either newly-allocated or from the free list.
ArenaBlockAllocatorBase & operator=(const ArenaBlockAllocatorBase &)=delete
virtual void erase() override
Free all allocated elements and release memory back to the system.
virtual ~ArenaBlockAllocatorBase()
Destructor.
void eraseUnprotected()
Free all allocated elements and release memory back to the system.
ArenaAllocatorBase::Stats m_stats
The statistics structure.
void swap(ArenaBlockAllocatorBase &other)
Swap.
ArenaBlockAllocatorBase(const Params &params)
Constructor.
void protect()
Write-protect the memory managed by this allocator.
ArenaBlock * m_blocks
The list of blocks currently in use.
virtual Stats stats() const override
Return the statistics block for this allocator.
Params m_params
The parameters for this allocator.
virtual const std::string & name() const override
Return the name of this allocator.
ArenaBlock * m_freeblocks
The list of free blocks.
bool m_protected
Flag whether the arena has been protected.
A large memory block that gets carved into smaller uniform elements.
Definition ArenaBlock.h:43
Forward declaration.
Statistics for an allocator.