Use shrink_to_fit() to save memory space

This commit is contained in:
Markus Gans 2019-04-27 01:23:30 +02:00
parent ec502d208a
commit 83fbc0a4f5
8 changed files with 11 additions and 1 deletions

View File

@ -1,5 +1,6 @@
2019-04-27 Markus Gans <guru.mail@muenster.de>
* Add the reserve() method to FListBox to increase the capacity of the list
* Use shrink_to_fit() to save memory space
2019-03-24 Markus Gans <guru.mail@muenster.de>
* Add a "scroll view" chapter to the first steps document

View File

@ -444,6 +444,7 @@ void FFileDialog::clear()
std::free (entry.name);
dir_entries.clear();
dir_entries.shrink_to_fit();
}
//----------------------------------------------------------------------

View File

@ -286,6 +286,7 @@ void FListBox::clear()
{
std::size_t size;
itemlist.clear();
itemlist.shrink_to_fit();
current = 0;
xoffset = 0;
yoffset = 0;

View File

@ -93,6 +93,7 @@ void FMenuList::remove (int pos)
void FMenuList::clear()
{
item_list.clear();
item_list.shrink_to_fit();
}
//----------------------------------------------------------------------

View File

@ -359,6 +359,7 @@ bool FObject::delAllTimer()
timer_modify_lock = true;
timer_list->clear();
timer_list->shrink_to_fit();
timer_modify_lock = false;
return true;
}

View File

@ -306,6 +306,7 @@ void FStatusBar::remove (int pos)
void FStatusBar::clear()
{
key_list.clear();
key_list.shrink_to_fit();
}
//----------------------------------------------------------------------

View File

@ -274,6 +274,7 @@ void FTextView::clear()
{
std::size_t size;
data.clear();
data.shrink_to_fit();
xoffset = 0;
yoffset = 0;
maxLineWidth = 0;

View File

@ -151,7 +151,10 @@ inline bool FTermBuffer::isEmpty() const
//----------------------------------------------------------------------
inline void FTermBuffer::clear()
{ data.clear(); }
{
data.clear();
data.shrink_to_fit();
}
//----------------------------------------------------------------------
inline FTermBuffer& FTermBuffer::write()