24 return get_global_ptr()->ns_alloc(size);
35 return get_global_ptr()->_total_alloc;
46 return get_global_ptr()->_total_used;
60 global_ptr->_lock.acquire();
61 size_t total_unused = global_ptr->_total_alloc - global_ptr->_total_used;
62 global_ptr->_lock.release();
84 INLINE NeverFreeMemory::Page::
85 Page(
void *start,
size_t size) :
86 _next((
unsigned char *)start),
96 INLINE
bool NeverFreeMemory::Page::
97 operator < (
const NeverFreeMemory::Page &other)
const {
98 return _remaining < other._remaining;
106 INLINE
void *NeverFreeMemory::Page::
108 assert(size <= _remaining);
109 void *result = _next;
This class is used to allocate bytes of memory from a pool that is never intended to be freed...
static size_t get_total_unused()
Returns the difference between get_total_alloc() and get_total_used().
static size_t get_total_alloc()
Returns the total number of bytes consumed by all the pages allocated internally by this object...
static void * alloc(size_t size)
Returns a pointer to a newly-allocated block of memory of the indicated size.
static size_t get_total_used()
Returns the total number of bytes requested by the application in calls to NeverFreeMemory::alloc().