Index: string =================================================================== --- string +++ string @@ -2103,7 +2103,15 @@ #endif { clear(); - shrink_to_fit(); + + size_type __cap = capacity(); + // check if we need to deallocate anything + if(__recommend(0) != __cap) + { + pointer __old_data = __get_long_pointer(); + __alloc_traits::deallocate(__alloc(), __old_data, __cap + 1); + __set_short_size(0); + } __r_.first() = __str.__r_.first(); __move_assign_alloc(__str); __str.__zero();