ATLAS Offline Software
Loading...
Searching...
No Matches
ArenaSharedHeapSTLAllocator.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
11
12
14
15
16namespace SG {
17
18
27 int nblock)
28 : m_owner (owner),
29 m_nblock (nblock)
30{
31}
32
33
40{
41 size_t sz = m_allocators.size();
42 for (size_t i = 0; i < sz; i++) {
43 delete m_allocators[i];
44 }
45}
46
47
52{
54 size_t sz = m_allocators.size();
55 for (size_t i = 0; i < sz; i++) {
56 if (m_allocators[i])
57 stats += m_allocators[i]->stats();
58 }
59 return stats;
60}
61
62
67void ArenaSharedHeapSTLHeader::report (std::ostream& os) const
68{
69 for (size_t i = 0; i < m_allocators.size(); i++) {
70 if (m_allocators[i])
71 m_allocators[i]->report (os);
72 }
73}
74
75
83{
85 if (a) {
86 a->protect();
87 }
88 }
89}
90
91
99{
101 if (a) {
102 a->unprotect();
103 }
104 }
105}
106
107
108} // namespace SG
STL-style allocator wrapper for ArenaHeapAllocator allowing the heap to be shared between containers.
static Double_t sz
static Double_t a
Heap-based allocator.
const void * m_owner
Address of the allocator that created this header.
ArenaAllocatorBase::Stats totstats() const
Return allocator statistics summed over all our owned allocators.
void protect()
Write-protect the memory managed by these allocators.
void unprotect()
Write-enable the memory managed by these allocators.
void report(std::ostream &os) const
Generate printable report for all contained allocators.
size_t m_nblock
Saved value for nblock parameter.
ArenaSharedHeapSTLHeader(const void *owner, int nblock)
Constructor.
std::vector< ArenaHeapAllocator * > m_allocators
List of allocators.
Forward declaration.
Statistics for an allocator.