44 size_t instances,
size_t element_size,
45 const char *pool_name)
46 :
mem_usage (allocated, times, peak, instances),
65 char *location_string = loc->
to_string ();
67 fprintf (stderr,
"%-32s%-48s " PRsa(5)
PRsa(9)
":%5.1f%%"
78 free (location_string);
85 fprintf (stderr,
"%-32s%-48s %6s%11s%16s%17s%12s\n",
"Pool name", name,
86 "Pools",
"Leak",
"Peak",
"Times",
"Elt size");
93 fprintf (stderr,
"%s" PRsa(82)
PRsa(10)
"\n",
"Total",
118template <
size_t BlockSize>
119class custom_block_allocator
122 static const size_t block_size = BlockSize;
125 allocate () ATTRIBUTE_MALLOC
127 return XNEWVEC (
char, BlockSize);
131 release (
void *block)
140template <
typename TBlockAllocator>
184 get_instance (
void *data_ptr)
203 return (((x+7) >> 3) << 3);
239template <
typename TBlockAllocator>
251template <
typename TBlockAllocator>
275 if (GATHER_STATISTICS)
300template <
typename TBlockAllocator>
312 next_block = block->
next;
313 TBlockAllocator::release (block);
331template <
typename TBlockAllocator>
339template <
typename TBlockAllocator>
346template <
typename TBlockAllocator>
354#ifdef ENABLE_VALGRIND_ANNOTATIONS
358 if (GATHER_STATISTICS)
363#ifdef ENABLE_VALGRIND_ANNOTATIONS
376 block =
reinterpret_cast<char *
> (TBlockAllocator::allocate ());
420 allocation_object::get_instance (
header)->id =
m_id;
428template <
typename TBlockAllocator>
442 gcc_assert (
m_id == allocation_object::get_instance (
object)->
id);
445 memset (
object, 0xaf, size);
450 allocation_object::get_instance (
object)->id = 0;
459 if (GATHER_STATISTICS)
467template <
typename TBlockAllocator>
569 return a.allocate_raw ();
mem_alloc_description< pool_usage > pool_allocator_usage
Definition alloc-pool.cc:27
ALLOC_POOL_ID_TYPE last_id
Definition alloc-pool.cc:26
bool after_memory_report
Definition alloc-pool.cc:28
mem_alloc_description< pool_usage > pool_allocator_usage
Definition alloc-pool.cc:27
ALLOC_POOL_ID_TYPE last_id
Definition alloc-pool.cc:26
base_pool_allocator< memory_block_pool > pool_allocator
Definition alloc-pool.h:477
hash_map< const char *, alloc_pool_descriptor > * alloc_pool_hash
void dump_alloc_pool_statistics(void)
Definition alloc-pool.cc:32
bool after_memory_report
Definition alloc-pool.cc:28
unsigned long ALLOC_POOL_ID_TYPE
Definition alloc-pool.h:31
size_t m_elts_free
Definition alloc-pool.h:224
const char * m_name
Definition alloc-pool.h:206
~base_pool_allocator()
Definition alloc-pool.h:340
char * m_virgin_free_list
Definition alloc-pool.h:216
void release_if_empty()
Definition alloc-pool.h:333
size_t m_virgin_elts_remaining
Definition alloc-pool.h:220
ALLOC_POOL_ID_TYPE m_id
Definition alloc-pool.h:207
allocation_pool_list * m_block_list
Definition alloc-pool.h:228
allocation_pool_list * m_returned_free_list
Definition alloc-pool.h:212
void initialize()
Definition alloc-pool.h:253
size_t m_size
Definition alloc-pool.h:232
base_pool_allocator(const char *name, size_t size CXX_MEM_STAT_INFO)
Definition alloc-pool.h:241
size_t m_elts_per_block
Definition alloc-pool.h:208
size_t num_elts_current()
size_t m_blocks_allocated
Definition alloc-pool.h:226
void remove(void *object)
static size_t align_eight(size_t x)
Definition alloc-pool.h:201
size_t m_elt_size
Definition alloc-pool.h:230
size_t m_elts_allocated
Definition alloc-pool.h:222
void release()
Definition alloc-pool.h:302
mem_location m_location
Definition alloc-pool.h:236
void * allocate() ATTRIBUTE_MALLOC
Definition alloc-pool.h:348
bool m_initialized
Definition alloc-pool.h:234
Definition mem-stats.h:278
Definition mem-stats.h:35
char * to_string()
Definition mem-stats.h:93
mem_usage()
Definition mem-stats.h:131
size_t m_allocated
Definition mem-stats.h:253
size_t m_peak
Definition mem-stats.h:257
size_t m_instances
Definition mem-stats.h:259
size_t m_times
Definition mem-stats.h:255
static float get_percent(size_t nominator, size_t denominator)
Definition mem-stats.h:230
Definition alloc-pool.h:482
pool_allocator m_allocator
Definition alloc-pool.h:540
void * allocate_raw() ATTRIBUTE_MALLOC
Definition alloc-pool.h:513
void remove_raw(void *object)
Definition alloc-pool.h:528
void remove(T *object)
Definition alloc-pool.h:519
object_allocator(const char *name CXX_MEM_STAT_INFO)
Definition alloc-pool.h:485
void release()
Definition alloc-pool.h:489
void release_if_empty()
Definition alloc-pool.h:494
size_t num_elts_current()
Definition alloc-pool.h:534
T * allocate() ATTRIBUTE_MALLOC
Definition alloc-pool.h:503
Definition alloc-pool.h:38
const char * m_pool_name
Definition alloc-pool.h:100
pool_usage()
Definition alloc-pool.h:41
pool_usage operator+(const pool_usage &second)
Definition alloc-pool.h:52
void dump(mem_location *loc, const mem_usage &total) const
Definition alloc-pool.h:63
pool_usage(size_t allocated, size_t times, size_t peak, size_t instances, size_t element_size, const char *pool_name)
Definition alloc-pool.h:43
size_t m_element_size
Definition alloc-pool.h:98
static void dump_header(const char *name)
Definition alloc-pool.h:83
void dump_footer()
Definition alloc-pool.h:91
static struct token T
Definition gengtype-parse.cc:45
FILE * header
Definition genrecog.cc:5393
#define PRIu64
Definition hwint.h:93
@ ALLOC_POOL_ORIGIN
Definition mem-stats-traits.h:33
Ca & a
Definition poly-int.h:770
#define PASS_MEM_STAT
Definition statistics.h:54
#define MEM_STAT_DECL
Definition statistics.h:52
#define CXX_MEM_STAT_INFO
Definition statistics.h:58
Definition alloc-pool.h:550
unsigned long current
Definition alloc-pool.h:556
unsigned long allocated
Definition alloc-pool.h:554
int elt_size
Definition alloc-pool.h:560
unsigned long created
Definition alloc-pool.h:552
unsigned long peak
Definition alloc-pool.h:558
Definition alloc-pool.h:163
static void * get_data(void *instance_ptr)
Definition alloc-pool.h:193
int64_t align_i
Definition alloc-pool.h:179
union base_pool_allocator::allocation_object::@267103222306076073205270232113306207323151343062 u
char data[1]
Definition alloc-pool.h:172
char * align_p
Definition alloc-pool.h:178
Definition alloc-pool.h:155
allocation_pool_list * next
Definition alloc-pool.h:156
Definition collect2.cc:168
#define NULL
Definition system.h:50
#define gcc_assert(EXPR)
Definition system.h:814
#define offsetof(TYPE, MEMBER)
Definition system.h:745
#define false
Definition system.h:888
#define VALGRIND_DISCARD(x)
Definition system.h:1215
#define SIZE_AMOUNT(size)
Definition system.h:1283
#define PRsa(n)
Definition system.h:1287
#define gcc_checking_assert(EXPR)
Definition system.h:821