Landing: acfdad706d8a

Project / Subsystem

gcc / libstdc++

Date

2026-04-04

Author

Nathan Myers

Commit

acfdad706d8acca6c4ed6ef3b63c2e02f1c47881

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
libstdc++
patch_id
commit_hash
acfdad706d8acca6c4ed6ef3b63c2e02f1c47881
source_type
github
headline
libstdc++ leverages allocate_at_least for string and vector.
tldr
The `std::string` and `std::vector` classes in libstdc++ now use `allocate_at_least` to better utilize allocated memory, potentially improving performance with…
author
Nathan Myers
outcome
committed
performance_win
true
breaking_change
false
series_id
series_parts
[]
tags
  • libstdc++
  • allocator
  • string
  • vector
  • memory management
discussion_id_link
bugzilla_pr
date
2026-04-04T00:00:00.000Z

This commit introduces the use of allocate_at_least in std::string and std::vector within libstdc++. This function allows the containers to utilize the maximum amount of storage provided by a custom allocator, potentially improving performance and reducing memory fragmentation. The implementation relies on the known alignment behavior of standard operator new. This change primarily benefits users employing custom allocators, as it enables them to expose more information about the actual allocated storage to the containers.