aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/stats/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vlib/stats/init.c')
-rw-r--r--src/vlib/stats/init.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/vlib/stats/init.c b/src/vlib/stats/init.c
index 2a7b6f53c53..16a47c2f78d 100644
--- a/src/vlib/stats/init.c
+++ b/src/vlib/stats/init.c
@@ -45,7 +45,6 @@ vlib_stats_init (vlib_main_t *vm)
vlib_stats_shared_header_t *shared_header;
vlib_stats_collector_reg_t reg = {};
- void *oldheap;
uword memory_size, sys_page_sz;
int mfd;
char *mem_name = "stat segment";
@@ -94,16 +93,14 @@ vlib_stats_init (vlib_main_t *vm)
sm->n_locks = 0;
clib_spinlock_init (sm->stat_segment_lockp);
- oldheap = clib_mem_set_heap (sm->heap);
-
/* Set up the name to counter-vector hash table */
- sm->directory_vector = 0;
+ sm->directory_vector =
+ vec_new_heap (typeof (sm->directory_vector[0]), STAT_COUNTERS, heap);
sm->dir_vector_first_free_elt = CLIB_U32_MAX;
shared_header->epoch = 1;
/* Scalar stats and node counters */
- vec_validate (sm->directory_vector, STAT_COUNTERS - 1);
#define _(E, t, n, p) \
strcpy (sm->directory_vector[STAT_COUNTER_##E].name, p "/" #n); \
sm->directory_vector[STAT_COUNTER_##E].type = STAT_DIR_TYPE_##t;
@@ -112,8 +109,6 @@ vlib_stats_init (vlib_main_t *vm)
/* Save the vector in the shared segment, for clients */
shared_header->directory_vector = sm->directory_vector;
- clib_mem_set_heap (oldheap);
-
vlib_stats_register_mem_heap (heap);
reg.collect_fn = vector_rate_collector_fn;