vppinfra: vector allocator rework
- support of in-place growth of vectors (if there is available space next to
existing alloc)
- drops the need for alloc_aligned_at_offset from memory allocator,
which allows easier swap to different memory allocator and reduces
malloc overhead
- rework of pool and vec macros to inline functions to improve debuggability
- fix alignment - in many cases macros were not using native alignment
of the particular datatype. Explicitly setting alignment with XXX_aligned()
versions of the macro is not needed anymore in > 99% of cases
- fix ASAN usage
- avoid use of vector of voids, this was root cause of several bugs
found in vec_* and pool_* function where sizeof() was used on voids
instead of real vector data type
- introduce minimal alignment which is currently 8 bytes, vectors will
be always aligned at least to that value (underlay allocator actually always
provide 16-byte aligned allocs)
Type: improvement
Change-Id: I20f4b081bb13bbf7bc0ace85cc4e301787f12fdf
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/src/vppinfra/ring.h b/src/vppinfra/ring.h
index 52b4261..d7e1915 100644
--- a/src/vppinfra/ring.h
+++ b/src/vppinfra/ring.h
@@ -38,11 +38,11 @@
void *v;
clib_ring_header_t *h;
- v = _vec_resize ((void *) 0,
- /* length increment */ size,
- /* data bytes */ elt_bytes * size,
- /* header bytes */ sizeof (h[0]),
- /* data align */ align);
+ v = _vec_realloc (0,
+ /* length increment */ size,
+ /* data bytes */ elt_bytes,
+ /* header bytes */ sizeof (h[0]),
+ /* data align */ align, 0);
h = clib_ring_header (v);
h->next = 0;