I have a very large vector as follows.
vector<vector<int>> a(100000, vector<int>(100000);
// do some work using a here
......
After the work is done, I use
vector<vector<int>>().swap(a);
in order to free the memory used by "a" immediately. I add
sleep(100)
after the swap and use "top" command to see whether memory usage is reduced immediately. But I observe that nothing has changed. What happens here?