In one of my projects, I'm using an unordered_map where I repeatedly clear and refill it. Each time, the number of points is roughly similar (but not identical), so preventing reallocation is beneficial.

With std::vector, calling clear or resize with a smaller size does not release existing memory held by the vector.

Code:
int size1 = 100;
int size2 = 50;
std::vector<int> foo;
foo.resize(size1);
foo.resize(size2); // should have no effect on the allocated memory
foo.clear(); // should also have no effect on the allocated memory
Is this behavior replicated by std::unordered_map?

Code:
int size1 = 100;
int size2 = 50;
std::unordered_map<int,int> foo;
foo.resize(size1);
foo.resize(size2); // will memory be released here?
foo.clear(); // will memory be released here?