-
-
Notifications
You must be signed in to change notification settings - Fork 561
Description
Hi y'all, we've recently run into some Crashed issues. These issues were mainly due to low user RAM being available.
From this code, we noticed that you guys set a limit of 512MB for usage before you start to automatically clean the usage.
For some devices, this is not an issue, and this limit could be way higher. But we observed that this could be an issue for older devices (like the iPhone X or older) which have <= 100MB of available RAM. We think this is the cause of these crashes (we're not sure how the OS lets this happen, honestly).
Meanwhile, I'm wondering if you would be open to working on an improvement to make this more dynamic, which means looking at how much available RAM the user has. We still want to be able to set a higher limit for devices that have the memory available, but we would like to reduce crashes on devices with low RAM.
Nuke/Sources/Nuke/Caching/ImageCache.swift
Lines 70 to 75 in c7ba483
| public static func defaultCostLimit() -> Int { | |
| let physicalMemory = ProcessInfo.processInfo.physicalMemory | |
| let ratio = physicalMemory <= (536_870_912 /* 512 Mb */) ? 0.1 : 0.2 | |
| let limit = min(536_870_912, physicalMemory / UInt64(1 / ratio)) | |
| return Int(limit) | |
| } |