From 65c1402ee66a37d8cdd294f64bfd6def4b9fcf3f Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Thu, 25 May 2023 13:08:43 +0200 Subject: [PATCH] ios: fix uv_getrusage() ru_maxrss calculation (#4027) Apple's documentation claims ru_maxrss is reported in kilobytes but the XNU source code suggests the actual unit is bytes, like macOS. Fixes: https://github.com/libuv/libuv/issues/4025 --- src/unix/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/unix/core.c b/src/unix/core.c index 2f8395f2..4db2b0af 100644 --- a/src/unix/core.c +++ b/src/unix/core.c @@ -1021,8 +1021,8 @@ int uv_getrusage(uv_rusage_t* rusage) { /* Most platforms report ru_maxrss in kilobytes; macOS and Solaris are * the outliers because of course they are. */ -#if defined(__APPLE__) && !TARGET_OS_IPHONE - rusage->ru_maxrss /= 1024; /* macOS reports bytes. */ +#if defined(__APPLE__) + rusage->ru_maxrss /= 1024; /* macOS and iOS report bytes. */ #elif defined(__sun) rusage->ru_maxrss /= getpagesize() / 1024; /* Solaris reports pages. */ #endif