ATLAS Offline Software
Loading...
Searching...
No Matches
ArenaHandleBase.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4
5// $Id: ArenaHandleBase.cxx 470529 2011-11-24 23:54:22Z ssnyder $
13
14
17
18
19namespace SG {
20
21
29 : m_allocator ( (header ? header : ArenaHeader::defaultHeader()) ->
30 allocator (index))
31{
32}
33
34
43 const EventContext& ctx,
44 size_t index)
45 : m_allocator ( (header ? header : ArenaHeader::defaultHeader()) ->
46 allocator (ctx, index))
47{
48}
49
50
57 : m_allocator (arena->allocator (index))
58{
59}
60
61
72{
73 return baseAllocator()->reset();
74}
75
76
88{
89 return baseAllocator()->erase();
90}
91
92
97 *
98 * This allows changing the number of elements that are currently free
99 * but cached. Any allocated elements are not affected by this call.
100 *
101 * If @c size is greater than the total number of elements currently
102 * cached, then more will be allocated. This will preferably done
103 * with a single block, but that is not guaranteed; in addition, the
104 * allocator may allocate more elements than is requested.
105 *
106 * If @c size is smaller than the total number of elements currently
107 * cached, as many blocks as possible will be released back to the system.
108 * It may not be possible to release the number of elements requested;
109 * this should be implemented on a best-effort basis.
110 */
111void ArenaHandleBase::reserve (size_t size)
112{
113 return baseAllocator()->reserve (size);
114}
115
116
125
126
127} // namespace SG
Common base class for arena allocator classes. See Arena.h for an overview of the arena-based memory ...
Base class for all Handle classes, containing parts that do not depend on the referenced type....
virtual void reset()=0
Free all allocated elements.
virtual void reserve(size_t size)=0
Set the total number of elements cached by the allocator.
virtual void erase()=0
Free all allocated elements and release memory back to the system.
virtual Stats stats() const =0
Return the statistics block for this allocator.
Part of Arena dealing with the list of allocators.
Definition ArenaBase.h:42
ArenaHandleBase(ArenaHeader *header, size_t index)
Constructor.
ArenaAllocatorBase * baseAllocator()
Return the current Allocator which we are referencing.
void reset()
Free all allocated elements (of this type in the current Arena).
void reserve(size_t size)
Set the total number of elements cached by the allocator (in the current Arena).
void erase()
Free all allocated elements and release memory back to the system (of this type in the current Arena)...
ArenaAllocatorBase::Stats stats() const
Return the statistics block for this allocator, for the current Arena.
LockedAllocator m_allocator
The associated allocator object.
Proxy for a group of Arenas.
Definition ArenaHeader.h:54
Forward declaration.
Definition index.py:1
Statistics for an allocator.