This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: sized delete in _Temporary_buffer<>


If I'm not mistaken this patch allocates N*sizeof(_Tp) bytes of storage and deallocates N bytes when sized deallocation is enabled?

Shouldn't __return_temporary_buffer deallocate N*sizeof(_Tp) instead to match the value passed to new?

________________________________
De : libstdc++-owner@gcc.gnu.org <libstdc++-owner@gcc.gnu.org> de la part de François Dumont <frs.dumont@gmail.com>
Envoyé : jeudi 18 juillet 2019 07:41
À : libstdc++@gcc.gnu.org <libstdc++@gcc.gnu.org>; gcc-patches <gcc-patches@gcc.gnu.org>
Objet : sized delete in _Temporary_buffer<>

As we adopted the sized deallocation in the new_allocator why not doing
the same in _Temporary_buffer<>.

     * include/bits/stl_tempbuf.h (__detail::__return_temporary_buffer):
New.
     (~_Temporary_buffer()): Use latter.
     (_Temporary_buffer(_FIterator, size_type)): Likewise.

Tested w/o activating sized deallocation. I'll try to run tests with
this option activated.

Ok to commit ?

François


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]