f1c9ac9f23
These wrappers implement the ability to allocate room for several disparate objects as a single contiguous allocation while complying with their respective alignment constraints. This is usually more efficient than allocating and freeing them individually if they are not expected to be reallocated with rte_realloc(). A typical use case is when several objects that cannot be dissociated must be allocated together, as shown in the following example: struct b { ... struct d *d; } struct a { ... struct b *b; struct c *c; } struct mlx4_malloc_vec vec[] = { { .size = sizeof(struct a), .addr = &ptr_a, }, { .size = sizeof(struct b), .addr = &ptr_b, }, { .size = sizeof(struct c), .addr = &ptr_c, }, { .size = sizeof(struct d), .addr = &ptr_d, }, }; if (!mlx4_mallocv(NULL, vec, RTE_DIM(vec))) goto error; struct a *a = ptr_a; a->b = ptr_b; a->c = ptr_c; a->b->d = ptr_d; ... rte_free(a); Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>