id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 7796,Memory leak in condition_variable,zhnmju123@…,viboes,"Hi, an internal structure within condition_variable keeps growing and so does CPU consumption, until it brings my application to a crawl. My analysis: The follwing change in the recent boost version is responsible: boost/thread/win32/condition_variable.hpp: Now: (boost 1.52) {{{ ~entry_manager() { if (! entry->is_notified()) { entry->remove_waiter(); } } }}} Before: (boost 1.51) {{{ ~entry_manager() { entry->remove_waiter(); } }}} Result: basic_condition_variable::generations keeps growing endlessly; source: {{{ class basic_condition_variable { entry_ptr get_wait_entry() { [...] entry_ptr new_entry(new list_entry(wake_sem)); [...] }; }}} My test code: {{{ //producer: void setWorkload(const std::vector& newLoad) //context of main thread { { boost::unique_lock dummy(lockFiles); filesToLoad = newLoad; } conditionNewFiles.notify_one(); } //consumer Zstring extractNextFile() //context of worker thread, blocking { boost::unique_lock dummy(lockFiles); while (filesToLoad.empty()) conditionNewFiles.timed_wait(dummy, boost::posix_time::milliseconds(50)); //interruption point! Zstring fileName = filesToLoad.back(); filesToLoad.pop_back(); return fileName; } }}} Expectation: conditionNewFiles.timed_wait() should not increase ""basic_condition_variable::generations""! Test to verify this bug: Using ""conditionNewFiles.notify_all()"" instead of ""conditionNewFiles.notify_one()"" let's my application behave correctly without growing CPU consumption; internal table ""basic_condition_variable::generations"" has one entry. Regards, Zenju",Bugs,closed,,thread,Boost 1.52.0,Regression,duplicate,,