From 8f9fa6995eafe270a95d6a25da16d5e22d542070 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sun, 25 May 2025 17:40:00 +0200 Subject: [PATCH] Fix compilation issues --- Source/Engine/Platform/Apple/ApplePlatform.cpp | 13 +++++++++++++ Source/Engine/Platform/Win32/Win32Platform.cpp | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Source/Engine/Platform/Apple/ApplePlatform.cpp b/Source/Engine/Platform/Apple/ApplePlatform.cpp index ad86ed7da..bbb08ddaf 100644 --- a/Source/Engine/Platform/Apple/ApplePlatform.cpp +++ b/Source/Engine/Platform/Apple/ApplePlatform.cpp @@ -2,6 +2,9 @@ #if PLATFORM_MAC || PLATFORM_IOS +#define PLATFORM_MAC_CACHED PLATFORM_MAC +#define PLATFORM_IOS_CACHED PLATFORM_IOS + #include "ApplePlatform.h" #include "AppleUtils.h" #include "Engine/Core/Log.h" @@ -50,6 +53,10 @@ #include #endif +// System includes break those defines +#define PLATFORM_MAC PLATFORM_MAC_CACHED +#define PLATFORM_IOS PLATFORM_IOS_CACHED + CPUInfo Cpu; String UserLocale; double SecondsPerCycle; @@ -224,10 +231,16 @@ MemoryStats ApplePlatform::GetMemoryStats() ProcessMemoryStats ApplePlatform::GetProcessMemoryStats() { ProcessMemoryStats result; +#if PLATFORM_IOS + rusage_info_current rusage_payload; + proc_pid_rusage(getpid(), RUSAGE_INFO_CURRENT, (rusage_info_t*)&rusage_payload); + result.UsedPhysicalMemory = rusage_payload.ri_phys_footprint; +#else mach_task_basic_info_data_t taskInfo; mach_msg_type_number_t count = MACH_TASK_BASIC_INFO_COUNT; task_info(mach_task_self(), MACH_TASK_BASIC_INFO, (task_info_t)&taskInfo, &count); result.UsedPhysicalMemory = taskInfo.resident_size; +#endif result.UsedVirtualMemory = result.UsedPhysicalMemory; return result; } diff --git a/Source/Engine/Platform/Win32/Win32Platform.cpp b/Source/Engine/Platform/Win32/Win32Platform.cpp index 6b5eaa2ff..c002986c9 100644 --- a/Source/Engine/Platform/Win32/Win32Platform.cpp +++ b/Source/Engine/Platform/Win32/Win32Platform.cpp @@ -290,7 +290,7 @@ void* Win32Platform::AllocatePages(uint64 numPages, uint64 pageSize) if (!ptr) OutOfMemory(); #if COMPILE_WITH_PROFILER - OnMemoryAlloc(ptr, size); + OnMemoryAlloc(ptr, numBytes); #endif return ptr; }