I have a program:
#include <iostream>
#include <map>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <iomanip>
#include <vector>
#include <stdarg.h>
#include <stdio.h>
#include <unistd.h>
using namespace std;
int main() {
map<int, string> m;
for (int i = 0; i < 1000000; i++)
{
m[i] = "jahsdghsagdfv sahgvsahgd fvsahgdf fsdfjsadvhjgsd jhgfhsahfvsafh asfvasgfv jhgfdvsahgvfs";
}
m.clear();
while (1) {sleep(5);}
return 1;
}
clear() does nothing. In memory monitor I see memory usage 184 Mb and nothing change after clear. Why ? How to clear memory of map ?