std::allocator should use sized delete

Jonathan Wakely jwakely.gcc@gmail.com
Mon Jun 10 07:23:00 GMT 2019


On Mon, 10 Jun 2019 at 07:53, Victor via libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> On Fri, 7 Jun 2019 10:17:33 +0100
>   Jonathan Wakely <jwakely@redhat.com> wrote:
> > No, because if you don't use the very latest version of
> >tcmalloc
> > (released only two months ago) then sized delete can
> >crash the
> > process.
> >
> > See
> >https://gcc.gnu.org/ml/libstdc++/2019-05/msg00172.html
> >and the
> > earlier mails on this list such as
> > https://gcc.gnu.org/ml/libstdc++/2019-04/msg00012.html
> >and
> > https://gcc.gnu.org/ml/libstdc++/2019-03/msg00020.html
>
> How is tcmalloc version connected with gcc version? Is it
> ok to use gcc-10 with old tcmalloc?

It's not connected to the GCC version. But making stable GCC releases
use a feature that can crash the process doesn't seem wise to me.

By the time GCC 10 is released the fixed version of tcmalloc will be
more widespread.

> I use gcc-9 on RHEL 7. Does it use tcmalloc or jemalloc by
> default?

Neither, it uses Glibc malloc, which doesn't support sized delete at
all, so there's no benefit to std::allocator using it.

Using sized delete only helps if you replace the default malloc with
something else like tcmalloc.


> Is there only problem with zero-size deallocation case?

Yes.



More information about the Libstdc++ mailing list