diff --git a/libs/ardour/session_click.cc b/libs/ardour/session_click.cc index dd38b4ec75..bf90e1576e 100644 --- a/libs/ardour/session_click.cc +++ b/libs/ardour/session_click.cc @@ -124,6 +124,7 @@ Session::click (samplepos_t cycle_start, samplecnt_t nframes) const samplepos_t end = start + move; _click_points.clear (); + assert (_click_points.capacity() > 0); TempoMap::use()->get_grid_with_iterator (_click_iterator, _click_points, samples_to_superclock (start, sample_rate()), samples_to_superclock (end, sample_rate())); if (_click_points.empty()) { @@ -310,6 +311,12 @@ Session::setup_click_sounds (Sample** data, Sample const * default_data, samplec delete[] tmp; sf_close (sndfile); } + + /* Overwhelmingly likely that we will have zero or 1 click grid point + * per cycle. So this is really overkill. If it is too low, it just + * causes RT memory allocation inside TempoMap::get_grid_with_iterator(). + */ + _click_points.reserve (16); } void