Very slow FIOSPlatformMisc::GetDiskTotalAndFreeSpace

Hi!

Recently we’ve noticed that in certain scenarios we had very substantial freezes on IOS devices. I’ve investigated it and found that it was caused by FIOSPlatformMisc::GetDiskTotalAndFreeSpace which we called multiple times in such scenarios Specifically it was a call to NSURLVolumeAvailableCapacityForImportantUsageKey which at least on some IOS devices takes around 70ms. Additionally it seems like it’s wrong to use this method since it returns not space which is currently free but space which may be freed by removal of some temporary files. So in order to fix it I replaced call to NSURLVolumeAvailableCapacityForImportantUsageKey with NSURLVolumeAvailableCapacityKey which is very fast. Is it ok to do so or maybe there were some reasong to use NSURLVolumeAvailableCapacityForImportantUsageKey specifically?

Hi Ilya,

This was selected as the approach to expose the true maximum available space. However, given your observations of 70ms stalls (device information would be appreciated), we will be updating the implementation to make use of NSURLVolumeAvailableCapacityForImportantUsageKey and default to the fast and predictable NSURLVolumeAvailableCapacityKey.

Best regards.

Hi [Content removed]

70ms was measured on iPad Air 4th Gen. Lags were noticed also at least on iPad 11 Pro.

Thanks for the information Ilya.

Here is the official CL https://github.com/EpicGames/UnrealEngine/commit/650a68de1a5d09b1acff8ba502e5cdb70202dbe4

Best regards.