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

Nick Connolly nick.connolly at mayadata.io
Tue Feb 23 22:53:15 CET 2021

> 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.  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.


More information about the dev mailing list