Thread (132 messages) 132 messages, 13 authors, 2021-04-29

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

From: Andrew Rybchenko <hidden>
Date: 2021-02-24 07:21:47

On 2/24/21 12:53 AM, Nick Connolly wrote:
quoted
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
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help