18 #ifndef _reallocpool_h_
19 #define _reallocpool_h_
28 #define RAP_BLOCKSIZE 7
31 #ifdef RAP_WITH_SEGMENT_STATS
32 #define RAP_WITH_CALL_STATS
49 void set_name (
const std::string& n) { _name = n; }
51 static void *
lalloc (
void* pool,
void *ptr,
size_t oldsize,
size_t newsize) {
52 return static_cast<ReallocPool*
>(pool)->_realloc (ptr, oldsize, newsize);
56 return _realloc (NULL, 0, size);
60 if (ptr) _realloc (ptr, 0, 0);
63 void *
realloc (
void *ptr,
size_t newsize) {
64 return _realloc (ptr, _asize(ptr), newsize);
70 #ifdef RAP_WITH_CALL_STATS
71 size_t mem_used ()
const {
return _cur_used; }
80 #ifdef RAP_WITH_SEGMENT_STATS
82 size_t _cur_allocated;
83 size_t _max_allocated;
84 size_t _seg_cur_count;
85 size_t _seg_max_count;
87 size_t _seg_max_avail;
88 void collect_segment_stats ();
90 #ifdef RAP_WITH_CALL_STATS
100 #ifdef RAP_WITH_HISTOGRAM
101 size_t _hist_alloc [RAP_WITH_HISTOGRAM];
102 size_t _hist_free [RAP_WITH_HISTOGRAM];
103 size_t _hist_grow [RAP_WITH_HISTOGRAM];
104 size_t _hist_shrink [RAP_WITH_HISTOGRAM];
106 unsigned int hist_bin (
size_t s)
const;
107 void print_histogram (
size_t const *
const histogram)
const;
110 void *
_realloc (
void *ptr,
size_t oldsize,
size_t newsize);
ReallocPool(std::string name, size_t bytes)
void set_name(const std::string &n)
void _shrink(void *, size_t)
void * _realloc(void *ptr, size_t oldsize, size_t newsize)
void consolidate_ptr(char *)
void * realloc(void *ptr, size_t newsize)
void * malloc(size_t size)
static void * lalloc(void *pool, void *ptr, size_t oldsize, size_t newsize)
GtkImageIconNameData name