08/08/12 14:19:03
#include <iostream>
#include <vector>
#include <windows.h>
#include <psapi.h>
#pragma comment(lib, "psapi.lib")
int WorkSize(void){
PROCESS_MEMORY_COUNTERS info;
GetProcessMemoryInfo(GetCurrentProcess(),&info,sizeof info);
return info.WorkingSetSize;
}
using namespace std;
int pm=WorkSize();
void MyFunc(){
vector<string> vec;
for(int i = 0; i < 1000000; i++)
vec.push_back("abcdefghijklmnopqrstuvwxyz");
cout<<WorkSize()-pm<<endl;
}
int main(){
cout<<WorkSize()-pm<<endl;
MyFunc();
cout<<WorkSize()-pm<<endl;
system("pause");
return 0;
}
VC++2008でvector+stringを使ったらメモリ解放しきれてないみたいなのですが、
これはちゃんと解放しきる事は出来ないのでしょうか。