2 ms·
glibc allocates in its fallback algorithm within qsort. It has to free the allocation when a C++ exception is thrown in a comparison, unless it wants to leak.
by leni536 2y ago
glibc allocates in its fallback algorithm within qsort. It has to free the allocation when a C++ exception is thrown in a comparison, unless it wants to leak. I recently filed a ticket for this. They kinda have to compile at least qsort with -fexceptions, unless they use a fully in-place sorting algorithm.
- eqvinox 2y agoOof, what an ugly issue… I kinda thought (hoped?) it'd be in-place anyway and thus not need any heap interactions, but I guess it does and they have no leeway to change the (fallback) algorithm… It's a bit weird for the C++ standard to require behavior off C standard functions though, I gotta say… seems more sensible to use a C++ sort…