mirror of http://192.168.1.51:8099/lmh188/twain3.0
增加当前进程内存使用量获取类,用于内存控制时使用
This commit is contained in:
parent
4375ccfdc3
commit
e74350d1c5
|
@ -0,0 +1,14 @@
|
|||
#include "GetMemoryUsage.h"
|
||||
#include <windows.h>
|
||||
#include <Psapi.h>
|
||||
|
||||
int GetMemoryUsage::CurrentProcessMemoryInfo()
|
||||
{
|
||||
HANDLE handle = GetCurrentProcess();
|
||||
PROCESS_MEMORY_COUNTERS_EX pmc = { 0 };
|
||||
int a = sizeof(pmc);
|
||||
if (!GetProcessMemoryInfo(handle, (PROCESS_MEMORY_COUNTERS*)&pmc, sizeof(pmc)))
|
||||
return -1;
|
||||
else
|
||||
return pmc.PeakPagefileUsage / 1024 / 1024;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
#pragma once
|
||||
class GetMemoryUsage
|
||||
{
|
||||
public:
|
||||
static int CurrentProcessMemoryInfo();
|
||||
};
|
||||
|
Loading…
Reference in New Issue