diff --git a/include/libtorrent/debug.hpp b/include/libtorrent/debug.hpp index 8d1ada442..12576de52 100644 --- a/include/libtorrent/debug.hpp +++ b/include/libtorrent/debug.hpp @@ -111,9 +111,14 @@ namespace libtorrent async_t& a = _async_ops[name]; TORRENT_ASSERT(a.refs > 0); --a.refs; - _wakeups.push_back(wakeup_t()); - wakeup_t& w = _wakeups.back(); - w.timestamp = time_now_hires(); + + // don't let this grow indefinitely + if (_wakeups.size() < 100000) + { + _wakeups.push_back(wakeup_t()); + wakeup_t& w = _wakeups.back(); + w.timestamp = time_now_hires(); + } #ifdef __MACH__ task_events_info teinfo; mach_msg_type_number_t t_info_count = TASK_EVENTS_INFO_COUNT;