http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57440
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- Also I can't reproduce this on GNU/Linux, the memory usage is bounded as expected. I'm surprised this even compiles with Mingw, are you using Mingw-w64 with libpthread-win32? Since it seems to be platform-specific it could be a resource leak of mutexes or condition variables, so my wild guess is that libpthread-win32 requires pthread_mutex_destroy or pthread_cond_destroy to be used. Does it make any difference if you add these to the very top of the source file, before including any headers? #define _GTHREAD_USE_MUTEX_INIT_FUNC #define _GTHREAD_USE_COND_INIT_FUNC