4#include "Stroika/Foundation/StroikaPreComp.h"
6#if qStroika_Foundation_Common_Platform_Windows
25 GlobalAllocationStatistics s;
26#if qStroika_Foundation_Common_Platform_Windows
27 HANDLE hProcess = ::OpenProcess (PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, ::GetCurrentProcessId ());
28 if (hProcess !=
nullptr) {
29#pragma comment(lib, "Psapi.lib")
30 PROCESS_MEMORY_COUNTERS pmc{};
31 pmc.cb =
sizeof (pmc);
32 if (::GetProcessMemoryInfo (hProcess, &pmc,
sizeof (pmc))) {
33 s.fPageFaultCount = pmc.PageFaultCount;
34 s.fPagefileUsage = pmc.PagefileUsage;
35 s.fWorkingSetSize = pmc.WorkingSetSize;
36#if qOverrideOpNewDeleteForAccounting
37 s.fTotalOutstandingAllocations = GetAllocator_ ().GetNetAllocationCount ();
38 s.fTotalOutstandingBytesAllocated = GetAllocator_ ().GetNetAllocatedByteCount ();
39#elif qStroika_Foundation_Debug_AssertionsChecked
40 _CrtMemState memState;
41 _CrtMemCheckpoint (&memState);
42 s.fTotalOutstandingAllocations = memState.lCounts[_NORMAL_BLOCK] + memState.lCounts[_CLIENT_BLOCK];
43 s.fTotalOutstandingBytesAllocated = memState.lSizes[_NORMAL_BLOCK] + memState.lSizes[_CLIENT_BLOCK];
46 ::CloseHandle (hProcess);