class ThreadSafeArena
Defined at line 41 of file ../../third_party/protobuf/src/google/protobuf/thread_safe_arena.h
This class provides the core Arena memory allocation library. Different
implementations only need to implement the public interface below.
Arena is not a template type as that would only be useful if all protos
in turn would be templates, which will/cannot happen. However separating
the memory allocation part from the cruft of the API users expect we can
use #ifdef the select the best implementation based on hardware / OS.
Public Members
static const size_t kBlockHeaderSize
static const size_t kSerialArenaSize
static const size_t kAllocPolicySize
static const size_t kMaxCleanupNodeSize
Public Methods
void ThreadSafeArena ()
void ThreadSafeArena (char * mem, size_t size)
void ThreadSafeArena (void * mem, size_t size, const AllocationPolicy & policy)
void ThreadSafeArena (const ThreadSafeArena & )
All protos have pointers back to the arena hence Arena must have
pointer stability.
Defined at line 52 of file ../../third_party/protobuf/src/google/protobuf/thread_safe_arena.h
ThreadSafeArena & operator= (const ThreadSafeArena & )
Defined at line 53 of file ../../third_party/protobuf/src/google/protobuf/thread_safe_arena.h
void ThreadSafeArena (ThreadSafeArena && )
Defined at line 54 of file ../../third_party/protobuf/src/google/protobuf/thread_safe_arena.h
ThreadSafeArena & operator= (ThreadSafeArena && )
Defined at line 55 of file ../../third_party/protobuf/src/google/protobuf/thread_safe_arena.h
template <AllocationClient alloc_client = AllocationClient::kDefault>
void * AllocateAligned (size_t n)
Defined at line 69 of file ../../third_party/protobuf/src/google/protobuf/thread_safe_arena.h
void ~ThreadSafeArena ()
Destructor deletes all owned heap allocated objects, and destructs objects
that have non-trivial destructors, except for proto2 message objects whose
destructors can be skipped. Also, frees all blocks except the initial block
if it was passed in.
uint64_t Reset ()
void ReturnArrayMemory (void * p, size_t size)
Defined at line 78 of file ../../third_party/protobuf/src/google/protobuf/thread_safe_arena.h
bool MaybeAllocateAligned (size_t n, void ** out)
This function allocates n bytes if the common happy case is true and
returns true. Otherwise does nothing and returns false. This strange
semantics is necessary to allow callers to program functions that only
have fallback function calls in tail position. This substantially improves
code for the happy path.
Defined at line 90 of file ../../third_party/protobuf/src/google/protobuf/thread_safe_arena.h
uint64_t SpaceAllocated ()
uint64_t SpaceUsed ()
void * AllocateAlignedWithCleanup (size_t n, size_t align, void (*)(void *) destructor)
void AddCleanup (void * elem, void (*)(void *) cleanup)
Add object pointer and cleanup function pointer to the list.
void * AllocateFromStringBlock ()
std::vector<void *> PeekCleanupListForTesting ()
Friends
class ChunkList
class SerialArenaChunkHeader
class SerialArena
class TcParser
class ArenaBenchmark