You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a SwiftUI multiplatform project where I have a ScrollView containing a LazyVGrid, which contains a bunch of VStacks containing a AnimatedImages, all of which are given the purgeable(true), pausable(false), resizable(), and scaledToFit() modifier, and a Text. The VStack is given a contextMenu modifier that passes in a text, button, or a combination of the two (the text and/or buttons could be wrapped in a view and the same thing would happen).
On iOS, if I activate the context menu (by long pressing on the VStack), there isn't a spike in RAM use. However, on macOS, if I activate the context menu (by clicking on the VStack with two fingers), the RAM use spikes and never drops down at all, indicating a memory leak issue. I'm not too sure how this is happening, but I have a suspicion that there is something to do with either macOS's implementation of a LazyVGrid or how AnimatedImage is implemented on macOS.
The text was updated successfully, but these errors were encountered:
AnimatedImage (actually, it use a UIViewRepresentable SDAnimatedImageView) has a onDisappear clear frame cache behavior on iOS, rely on iOS's UIKit UIView lifecycle. And has a low memory warning to clear frame cache, rely UIApplicationDidReceiveMemoryWarning notification.
This does not works on macOS seems (The onDisappear should be works I think).
But it's not a "leak" in general, if you totally make your LazyGrid disappear, the cache frame should be free.
Here is a Xcode project demo that basically demonstrates the issue. I am pulling the images from a remote source (Giphy) and the issue described above still occurs. https://github.com/andylin2004/TestGifVGridApp
I have a SwiftUI multiplatform project where I have a
ScrollView
containing aLazyVGrid
, which contains a bunch of VStacks containing aAnimatedImage
s, all of which are given thepurgeable(true)
,pausable(false)
,resizable()
, andscaledToFit()
modifier, and aText
. TheVStack
is given acontextMenu
modifier that passes in a text, button, or a combination of the two (the text and/or buttons could be wrapped in a view and the same thing would happen).On iOS, if I activate the context menu (by long pressing on the
VStack
), there isn't a spike in RAM use. However, on macOS, if I activate the context menu (by clicking on theVStack
with two fingers), the RAM use spikes and never drops down at all, indicating a memory leak issue. I'm not too sure how this is happening, but I have a suspicion that there is something to do with either macOS's implementation of aLazyVGrid
or howAnimatedImage
is implemented on macOS.The text was updated successfully, but these errors were encountered: