I am using the example code of regex iterator in http://www.boost.org/doc/libs/1_55_0/libs/regex/doc/html/boost_regex/ref/reg... , in a linux machine with default boost config which means NON RECURSIVE, and 4096 block size , I run the example with mtrace , setting it at first line of main method and doing muntrace right before return 0, I see that 4096 bytes get lost based on mtrace logs. if there are no flaws in my test, then is there something I should separately call to free up that memory? Otherwise that blocks seems lost to me. The original reason I started this test was that I have a similar code, and I see memory corruption on my machine which is causing connection drops to my rabbitmq server and it goes away as soon as I comment out the following three lines. So I think there is something wrong with the memory allocations of boost regex iterator. boost::sregex_iterator m1(text.begin(), text.end(), expression); boost::sregex_iterator m2; std::for_each(m1, m2, ®ex_callback); Thanks --