40 "MemBlob created: " <<
alloc <<
41 "\nMemBlob alive: " <<
live <<
42 "\nMemBlob append calls: " <<
append <<
43 "\nMemBlob currently allocated size: " <<
liveBytes <<
44 "\nlive MemBlob mean current allocation size: " <<
52 mem(nullptr), capacity(0),
size(0)
55 <<
static_cast<void*
>(
this) <<
" id=" <<
id
56 <<
" reserveSize=" << reserveSize);
61 mem(nullptr), capacity(0),
size(0)
64 <<
static_cast<void*
>(
this) <<
" id=" <<
id
65 <<
" buffer=" <<
static_cast<const void*
>(buffer)
66 <<
" bufSize=" << bufSize);
80 <<
static_cast<void*
>(
this) <<
" id=" <<
id
91 size_t actualAlloc = minSize;
100 id <<
" memAlloc: requested=" << minSize <<
121 memmove(
mem +
size, source, n);
131 Must(LockCount() <= 1);
140 Must(LockCount() <= 1);
157 os <<
"id @" << (
void *)
this
158 <<
"mem:" <<
static_cast<void*
>(
mem)
161 <<
",refs:" << LockCount() <<
"; ";
InstanceIdDefinitions(MemBlob, "blob")
#define MEMBLOB_DEBUGSECTION
Various MemBlob class-wide statistics.
uint64_t live
number of MemBlob instances currently alive
uint64_t liveBytes
the total size of currently allocated storage
uint64_t alloc
number of MemBlob instances created so far
uint64_t append
number of MemBlob::append() calls
MemBlobStats & operator+=(const MemBlobStats &)
std::ostream & dump(std::ostream &os) const
dumps class-wide statistics
char * mem
raw allocated memory block
void append(const char *source, const size_type n)
void syncSize(const size_type n)
bool willFit(const size_type n) const
whether n more bytes can be appended
MemBlob(const size_type reserveSize)
create a new MemBlob with at least reserveSize capacity
size_type size
maximum allocated memory in use by callers
static MemBlobStats Stats
class-wide statistics
static const MemBlobStats & GetStats()
obtain a const view of class-wide statistics
void memAlloc(const size_type memSize)
void appended(const size_type n)
std::ostream & dump(std::ostream &os) const
dump debugging information
void consume(const size_type n)
size_type capacity
size of the raw allocated memory block
static void RecordMemBlobSizeAtDestruct(size_t)
Record the size a MemBlob had when it was destructed.
A const & min(A const &lhs, A const &rhs)
#define debugs(SECTION, LEVEL, CONTENT)
void memFreeString(size_t size, void *)
void * memAllocString(size_t net_size, size_t *gross_size)