diff options
author | François Dumont <fdumont@gcc.gnu.org> | 2020-01-22 17:55:54 +0100 |
---|---|---|
committer | François Dumont <fdumont@gcc.gnu.org> | 2020-11-20 22:25:04 +0100 |
commit | ba23e045fcb820e8d32dee361c4d048604d8d599 (patch) | |
tree | d35174a854f07c7952fdf742c5aa6367dc5b20a5 /gcc | |
parent | 9e071b6e5ed5a07a4ce621382904c084431f9d47 (diff) | |
download | gcc-ba23e045fcb820e8d32dee361c4d048604d8d599.zip gcc-ba23e045fcb820e8d32dee361c4d048604d8d599.tar.gz gcc-ba23e045fcb820e8d32dee361c4d048604d8d599.tar.bz2 |
libstdc++: Limit memory allocation in stable_sort/inplace_merge (PR 83938)
Reduce memory allocation in stable_sort/inplace_merge algorithms to what is needed
by the implementation.
Co-authored-by: John Chang <john.chang@samba.tv>
libstdc++-v3/ChangeLog:
PR libstdc++/83938
* include/bits/stl_tempbuf.h (get_temporary_buffer): Change __len
computation in the loop to avoid truncation.
* include/bits/stl_algo.h:
(__inplace_merge): Take temporary buffer length from smallest range.
(__stable_sort): Limit temporary buffer length.
* testsuite/25_algorithms/inplace_merge/1.cc (test4): New.
* testsuite/performance/25_algorithms/stable_sort.cc: Test stable_sort
under different heap memory conditions.
* testsuite/performance/25_algorithms/inplace_merge.cc: New test.
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions