64,282
社区成员
发帖
与我相关
我的任务
分享
while (true)
{
if (GetTickCount() > 某一个值)
PostQuitMessage(0);
else
Sleep(1);
}
HANDLE hProcess = GetCurrentProcess();
PROCESS_MEMORY_COUNTERS pmc;
if (GetProcessMemoryInfo(hProcess, &pmc, sizeof(PROCESS_MEMORY_COUNTERS)))
{
if (pmc.WorkingSetSize > 1000 * 1024)
{
。。。
}
}
CloseHandle(hProcess);
#include <Windows.h>
#include <iostream>
#include <vector>
#define MAX_COUNT 60000000
typedef std::vector<int> VECTOR;
typedef std::vector<int>::iterator ITER;
int main()
{
VECTOR v;
DWORD t;
t = GetTickCount();
for (int i = 0; i < MAX_COUNT; ++i)
{
v.push_back(i);
}
std::cout << GetTickCount() - t << std::endl;
t = GetTickCount();
ITER end = v.end();
for (ITER iter = v.begin(); iter != end; ++iter)
{
(*iter)++;
}
std::cout << GetTickCount() - t << std::endl;
t = GetTickCount();
for (ITER iter = v.begin(); iter != v.end(); ++iter)
{
(*iter)++;
}
std::cout << GetTickCount() - t << std::endl;
system("pause");
return 0;
}