|
ATLAS Offline Software
|
Go to the documentation of this file.
43 static const size_t pageSize = sysconf (_SC_PAGESIZE);
44 size_t tot_size =
n*elt_size + ArenaBlockBodyOffset;
46 size_t tot_size_rounded = (tot_size + (pageSize-1)) & ~(pageSize-1);
48 size_t n_rounded = (tot_size_rounded - ArenaBlockBodyOffset) / elt_size;
49 assert (n_rounded >=
n);
51 (std::aligned_alloc (pageSize, tot_size_rounded));
54 p->m_elt_size = elt_size;
55 p->m_size = n_rounded;
57 for (
size_t i = 0;
i < n_rounded;
i++)
58 ctor (
p->index (
i, elt_size));
72 size_t elt_size =
p->eltSize();
74 for (
size_t i = 0;
i <
n;
i++) {
75 dtor (
p->index (
i, elt_size));
136 size_t elt_size =
p->eltSize();
141 for (
size_t i = 0;
i <
n;
i++) {
142 func (
p->index (
i, elt_size));
160 return ArenaBlockBodyOffset +
sizeof (size_t);
189 PROT_READ + PROT_WRITE);
205 for (;
p;
p =
p->link()) {
220 for (;
p;
p =
p->link()) {
Exception — Attempt to change memory protection failed.
void unprotect()
Write-enable this block.
static void destroy(ArenaBlock *p, func_t *dtor)
Destroy a block.
std::string tail(std::string s, const std::string &pattern)
tail of a string
static void applyList(ArenaBlock *p, func_t *func, size_t n)
Call a function on elements in a list of blocks.
static size_t overhead()
Return the per-block memory overhead, in bytes.
static ArenaBlock * newBlock(size_t n, size_t elt_size, func_t *ctor)
Create a new block.
static void appendList(ArenaBlock **headp, ArenaBlock *tail)
Concatenate two lists of blocks.
static void unprotectList(ArenaBlock *p)
Write-enable all blocks in a list.
ArenaBlock *& link()
Return the link pointer of the block.
size_t m_size
Number of elements in this block.
A large memory block that gets carved into smaller uniform elements.
static std::atomic< size_t > s_nactive
Global count of the number of blocks in use.
size_t m_elt_size
Size, in bytes, of each element in this block.
static void protectList(ArenaBlock *p)
Write-protect all blocks in a list.
void protect()
Write-protect this block.
static void destroyList(ArenaBlock *p, func_t *dtor)
Destroy all blocks in a list.
Exceptions that can be thrown from AthAllocators.
A large memory block that gets carved into smaller uniform elements. See Arena.h for an overview of t...