<分区>
我有一个程序:
#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() 什么都不做。在内存监视器中,我看到内存使用量为 184 Mb,清除后没有任何变化。为什么 ?如何清除 map 内存?