<html><head></head><body>I don't know what point you are trying to make here. Nobody questioned that mismatched heap allocators would crash. Of course they would.<br><br>The problem is that if you can't get the right free() function, then you can't call libvlc_free(). At that point, the code is probably already UB even before freeing the allocation either way.<br><br><div class="gmail_quote">Le 24 mai 2019 09:37:20 GMT+03:00, Steve Lhomme <robux4@ycbcr.xyz> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">On 2019-05-24 7:44, Steve Lhomme wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;">On 2019-05-24 7:25, Steve Lhomme wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;">On 2019-05-23 17:11, Rémi Denis-Courmont wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #8ae234; padding-left: 1ex;">Le torstaina 23. toukokuuta 2019, 13.57.32 EEST Steve Lhomme a écrit :<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #fcaf3e; padding-left: 1ex;">Here's another one: we could decide to rewrite libvlc in C++ and keep<br>the same ABI. Does that mean we would have to forced libvlc hosts to<br>call "delete psz-str" because we don't feel like keeping <br>libvlc_free() ?<br></blockquote><br> You would have to keep using malloc() otherwise you would break the <br> existing<br> ABI 3.0 or 4.0 anyway that says you can use free(). <br></blockquote><br> That's indeed a problem. I think the free() option should not have <br> been there in the first place. I would rather vote to remove this option.<br><br> For example we could decide that for performance reasons we allocate <br> using aligned_alloc(). On some system that requires an aligned_free(). <br> We cannot do that if we allow free() of a particular runtime.<br></blockquote><br>Another use case: building libvlc/vlc with allocation tooling, <br>redirecting malloc/free to debug leaks. Calling free() outside of libvlc <br>with memory allocated this will likely crash or report errors when a <br>legitimate free() is done. We should not tie our hands by allowing <br>free() at all.<br></blockquote><br>Attached is a quick example of a library done incorrectly:<br><br>The EXE links with the *debug* DLL C runtime, as most people would use <br>while debugging their code.<br><br>The DLL links with the *standard* DLL C runtime, as a distributed DLL <br>would use.<br><br>Calling free() on the memory returned by the DLL crashes with a heap <br>allocation error. That doesn't happen is the free() is done in the DLL.<br></pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>