diff --git a/src/ivoc/graph.cpp b/src/ivoc/graph.cpp index 60afbc81dc..9babcd0106 100644 --- a/src/ivoc/graph.cpp +++ b/src/ivoc/graph.cpp @@ -2085,6 +2085,7 @@ void Graph::erase_all() { Resource::unref(item); } line_list_.clear(); + line_list_.shrink_to_fit(); label_n_ = 0; } void Graph::family_value() { diff --git a/src/ivoc/ocpicker.cpp b/src/ivoc/ocpicker.cpp index 206aa842f0..76da6bee49 100644 --- a/src/ivoc/ocpicker.cpp +++ b/src/ivoc/ocpicker.cpp @@ -40,7 +40,6 @@ StandardPicker::StandardPicker() { ms_ = unknown; for (int i = 0; i < unknown; ++i) { handlers_[i] = new std::vector(); - handlers_[i]->reserve(1); } } StandardPicker::~StandardPicker() { diff --git a/src/ivoc/symdir.cpp b/src/ivoc/symdir.cpp index 510e1c54f5..bfc744dab7 100644 --- a/src/ivoc/symdir.cpp +++ b/src/ivoc/symdir.cpp @@ -219,6 +219,7 @@ void SymDirectoryImpl::disconnect(Observable*) { delete item; } symbol_lists_.clear(); + symbol_lists_.shrink_to_fit(); obj_ = NULL; } diff --git a/src/ivoc/xmenu.cpp b/src/ivoc/xmenu.cpp index 7278af96b4..74a5609b84 100644 --- a/src/ivoc/xmenu.cpp +++ b/src/ivoc/xmenu.cpp @@ -1027,7 +1027,6 @@ HocPanel::HocPanel(const char* name, bool h) } HocPanel::~HocPanel() { - long i; box_->unref(); for (auto& item: ilist_) { item->HocItem::unref(); @@ -1039,7 +1038,10 @@ HocPanel::~HocPanel() { if (it != hoc_panel_list->end()) { hoc_panel_list->erase(it); } + ilist_.clear(); + ilist_.shrink_to_fit(); elist_.clear(); + elist_.shrink_to_fit(); // printf("~HocPanel\n"); } @@ -1059,11 +1061,9 @@ std::vector* HocPanel::update_list_; void HocPanel::keep_updated() { static int cnt = 0; if (update_list_ && (++cnt % 10 == 0)) { - long i, cnt = update_list_->size(); - if (cnt) - for (auto& item: *update_list_) { - item->update_hoc_item(); - } + for (auto& item: *update_list_) { + item->update_hoc_item(); + } } } void HocPanel::keep_updated(HocUpdateItem* hui, bool add) { @@ -1372,7 +1372,6 @@ void HocPanel::save(std::ostream& o) { void HocPanel::write(std::ostream& o) { Oc oc; char buf[200]; - long i; // o << "xpanel(\"" << getName() << "\")" << std::endl; Sprintf(buf, "xpanel(\"%s\", %d)", getName(), horizontal_); o << buf << std::endl; diff --git a/src/nrncvode/occvode.cpp b/src/nrncvode/occvode.cpp index 60655d1801..bb2ec2db02 100644 --- a/src/nrncvode/occvode.cpp +++ b/src/nrncvode/occvode.cpp @@ -1080,7 +1080,6 @@ void Cvode::play_add(PlayRecord* pr) { CvodeThreadData& z = CTD(pr->ith_); if (!z.play_) { z.play_ = new std::vector(); - z.play_->reserve(1); } z.play_->push_back(pr); }