I have something that certainly looks like a memory leak. g++ --version g++ (GCC) 4.9.0 20131014 (experimental) g++ -std=gnu++11 -O2 leak.cpp If I increase the amount of looping the leak reports increases linearly. All output from valgrind below. It might be regex or it might be some allocator issue, I have seen something with std::deque as well outside any regex context. Not been able to reproduce though.
Created attachment 31011 [details] small program showing the problem
Created attachment 31012 [details] output from valgrind
Maybe: Index: regex_executor.h =================================================================== --- regex_executor.h (revision 203587) +++ regex_executor.h (working copy) @@ -155,6 +155,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION virtual bool _M_main() = 0; + virtual + ~_Executor() { } + _BiIter _M_current; const _BiIter _M_begin; const _BiIter _M_end; Eh, eh ;) ;)
Author: timshen Date: Tue Oct 15 15:01:44 2013 New Revision: 203610 URL: http://gcc.gnu.org/viewcvs?rev=203610&root=gcc&view=rev Log: 2013-10-15 Tim Shen <timshen91@gmail.com> PR libstdc++/58737 * include/bits/regex_automaton.h (_Automaton<>::~_Automaton): Fix memory leak by adding it. * include/bits/regex_executor.h (_Executor<>::~_Executor): Likewise. Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/bits/regex_automaton.h trunk/libstdc++-v3/include/bits/regex_executor.h
Fixed.