-
-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shrink to fit #36
Comments
clear() definitely releases the memory. Depending on the platform you are using (Windows?), you may not notice that the memory has been freed, but it has. For example if, after calling clear(), you create a second hash table with the same elements, the memory usage should not increase. |
I'm using Linux and Solaris. |
No C++ standard library class or function returns memory "back to the OS". The best C++ classes/methods can do is call delete (which is likely to call free), releasing memory back to the dynamic memory allocator. Whether the dynamic memory allocator releases the memory back to the OS is an implementation detail, not visible from C++. |
ok thanks for this clarification |
Is there somenthing like shrink_to_fit like we have for std::vector?
I tried to use clear and reserve(0) but the memory is not released.
Thanks
The text was updated successfully, but these errors were encountered: