on-internet
← Community

Does erase() delete heap memory used by elements of an stl::unordered_set?

Stack Overflow ·

I have an std::unordered_set<N> into which values are inserted by reference (your insert below is by copy, but I left "by reference" since it's your original message). I want to erase some elements from the set and reduce the malloc() memory used, but I can't see a reduction in memory. Is it possible to reduce malloc() memory using erase()? Will rehash() help after erase()? typedef typename std::unordered_set<N> ChangeObjSet; ChangeObjSet _changeObjSet; template <class N> void MdmNameCacheImplMIWithStripEscape<N>::insertChangedStatus(const N &obj) { _changeObjSet.insert(obj); } typename Change

Comments

Sign in or sign up to comment and upvote.

No comments yet.