WoW Model Viewer
Your premiere tool for viewing, equipping and animating World of Warcraft models.
Loading...
Searching...
No Matches
MemoryUtils.cpp
Go to the documentation of this file.
1#include "MemoryUtils.h"
2#include <windows.h>
3#include <Psapi.h>
4#pragma comment(lib, "psapi.lib") // Added to support GetProcessMemoryInfo()
5#include "logger\Logger.h"
6
7void core::displayMemInfo(std::string message, bool displaySQLiteSize)
8{
9 std::string log = message + " Memory: " + std::to_string(getMemoryUsed()) + " Mo";
10 LOG_INFO << log.c_str();
11}
12
14{
15 PROCESS_MEMORY_COUNTERS memCounter;
16 int result = -1;
17
18 if (GetProcessMemoryInfo(GetCurrentProcess(), &memCounter, sizeof(memCounter)))
19 result = memCounter.WorkingSetSize / (1024 * 1024);
20
21 return result;
22}
#define LOG_INFO
Definition Logger.h:10
void __cdecl displayMemInfo(std::string message, bool displaySQLiteSize=false)
Log current process memory usage to the Logger.
int __cdecl getMemoryUsed()
Return the current process memory usage in kilobytes.