http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47921
--- Comment #1 from Robert Python <RobertPython at 163 dot com> 2011-02-28 10:51:30 UTC --- try below program in a 64bit environment with about 8G memory: #include <string> #include <strstream> #include <iostream> #define N 100000000 #define SIZE 40 using namespace std; int main() { const char msg[SIZE] = "aaaaaaaaaaaaaaaaaaaaaaaaaaa"; strstreambuf *new_data = new strstreambuf(); for (int i = 0; i < N; ++i) { new_data->freeze(false); new_data->sputn(msg, SIZE); } delete new_data; return 0; }