fix wakeup profiling to not grow memory usage indefinitely

This commit is contained in:
Arvid Norberg 2015-01-20 16:15:45 +00:00
parent d9e69db0cb
commit f6474f5717
1 changed files with 8 additions and 3 deletions

View File

@ -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;