[dpdk-dev] [PATCH v3 1/7] eal: add wrappers for POSIX string functions

Andrew Rybchenko andrew.rybchenko at oktetlabs.ru
Wed Feb 24 08:21:42 CET 2021


On 2/24/21 12:53 AM, Nick Connolly wrote:
> 
>> Allocating memory using rte_strdup() I'd use rte_free()
>> to release it. I guess it will fail badly.
>> So, I think that a different, more specific prefix is
>> required for POSIX wrappers.
> 
> Andrew: my understanding of Bruce's proposal is that the strdup() name
> will now be kept (in this case through an inline definition), so I think
> this will be ok. 

Very good, glad to hear it. Thanks.

> However, your comment reminded me of something else
> that it's probably worth mentioning as an aside:
> 
> As a general guideline on Windows, memory allocated within a shared
> library is best freed within the same DLL to ensure it goes back to the
> correct heap.  So we'd want to avoid calling strdup and then returning
> the value to the application for it to free (hopefully this doesn't
> happen). With an inline definition there's no change in behaviour, but
> adding rte_strdup (or anything else that calls malloc) into librte_eal
> might be an issue.
> 
> Regards,
> Nick



More information about the dev mailing list