diff --git a/esphome/components/wifi/wifi_component.cpp b/esphome/components/wifi/wifi_component.cpp index afdaa0b6e8..352081fe31 100644 --- a/esphome/components/wifi/wifi_component.cpp +++ b/esphome/components/wifi/wifi_component.cpp @@ -2014,8 +2014,8 @@ void WiFiComponent::release_scan_results_() { // std::vector - use swap trick since shrink_to_fit is non-binding decltype(this->scan_result_)().swap(this->scan_result_); #else - // FixedVector::shrink_to_fit() actually frees all memory - this->scan_result_.shrink_to_fit(); + // FixedVector::release() frees all memory + this->scan_result_.release(); #endif } } diff --git a/esphome/core/helpers.h b/esphome/core/helpers.h index acba420d3e..05d2d475c1 100644 --- a/esphome/core/helpers.h +++ b/esphome/core/helpers.h @@ -293,8 +293,8 @@ template class FixedVector { size_ = 0; } - // Shrink capacity to fit current size (frees all memory) - void shrink_to_fit() { + // Release all memory (destroys elements and frees memory) + void release() { cleanup_(); reset_(); }