[PATCH v4 17/17] eal: add function attributes for allocation functions
Burakov, Anatoly
anatoly.burakov at intel.com
Tue Oct 1 14:21:02 CEST 2024
On 9/30/2024 8:44 PM, Stephen Hemminger wrote:
> The allocation functions take a alignment argument that
> can be useful to hint the compiler optimizer.
>
> This is supported by Gcc and Clang but only useful with
> Gcc because Clang gives warning if alignment is 0.
>
> Recent versions of GCC have a malloc attribute that can
> be used to find mismatches between allocation and free;
> the typical problem caught is a pointer allocated with
> rte_malloc() that is then incorrectly freed using free().
>
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
> Acked-by: Chengwen Feng <fengchengwen at huawei.com>
> ---
<snip>
>
> +
> +/**
> + * Frees the memory space pointed to by the provided pointer.
> + *
> + * This pointer must have been returned by a previous call to
> + * rte_malloc(), rte_zmalloc(), rte_calloc() or rte_realloc(). The behaviour of
> + * rte_free() is undefined if the pointer does not match this requirement.
> + *
> + * If the pointer is NULL, the function does nothing.
> + *
> + * @param ptr
> + * The pointer to memory to be freed.
> + */
> +void
> +rte_free(void *ptr);
> +
Is there any particular reason why rte_free was moved?
Otherwise,
Acked-by: Anatoly Burakov <anatoly.burakov at intel.com>
--
Thanks,
Anatoly
More information about the dev
mailing list