https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126337
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- The optimize flag could also cause the memory allocated by _Executor::_M_frames to be reused instead of deallocated by the _Executor destructor. On destruction, that memory could be put in another global (or thread-local) cache with the NFA's address as the key. The next time we construct an _Executor it could find the cached vector<_ExecutorFrame> and pilfer its storage. This would reduce the memory allocations done by repeated matches with the same basic_regex object.
