SDWebImageSwiftUI icon indicating copy to clipboard operation
SDWebImageSwiftUI copied to clipboard

Memory usage in iOS 17

Open Cyclic opened this issue 2 years ago • 1 comments

Hello,

We are running an app on iOS 17 with lots of images, and most of them are around 50K - 100K on disk. However, as you can see from the attached image, they are much larger in memory. In addition, SDWebImageSwiftUI does not appear to be releasing the memory as it once did. Has something been introduced that might have caused this other than iOS 17? It’s also worth noting that many of the images are either in a list or scroll view with a lazyvstack.

Thank you,

image

image

Cyclic avatar Jun 11 '23 23:06 Cyclic

I think this is just the pre-render using the native UIKit method. If this does not match what you want ? You can disable this pre-force-decode feature via avoidDecodedImage to use decode just on time

See:

SDWebImageManager.shared.optionsProcessor = SDWebImageOptionsProcessor() { url, options, context in
    // Disable Force Decoding in global, may reduce the frame rate
    var mutableOptions = options
    mutableOptions.insert(.avoidDecodeImage)
    return SDWebImageOptionsResult(options: mutableOptions, context: context)
}

dreampiggy avatar Jun 12 '23 06:06 dreampiggy