From 87f66dda48d9710826e1c3677b9b01345a50323c Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 7 Jul 2024 16:56:36 +0100 Subject: [PATCH] Shrink the geo_maxmind storage after garbage collection. --- include/flat_map.h | 1 + src/modules/extra/m_geo_maxmind.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/include/flat_map.h b/include/flat_map.h index 1a01ee7d6..34a450d44 100644 --- a/include/flat_map.h +++ b/include/flat_map.h @@ -98,6 +98,7 @@ public: void clear() { vect.clear(); } void reserve(size_type n) { vect.reserve(n); } + void shrink_to_fit() { vect.shrink_to_fit(); } iterator begin() { return vect.begin(); } iterator end() { return vect.end(); } diff --git a/src/modules/extra/m_geo_maxmind.cpp b/src/modules/extra/m_geo_maxmind.cpp index 20f494f70..fdce7d5c4 100644 --- a/src/modules/extra/m_geo_maxmind.cpp +++ b/src/modules/extra/m_geo_maxmind.cpp @@ -209,6 +209,7 @@ public: iter = geoapi.locations.erase(iter); } } + geoapi.locations.shrink_to_fit(); } void OnChangeRemoteAddress(LocalUser* user) override