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
Is your feature request related to a problem? Please describe.
I believe the Output image dimensions are now enforced to be less than 4096x4096 to guard against accidental OOMs feature added a side effect that is making the library miss memory caches and reloads from disk every time a composable with FillWidth and flexible height is used (say inside a LazyColumn). The log shows an error like: Memory cached image's size (1202, 2137) is smaller than the target size (1013, 4096). This cache should have been used because the image's width is appropriate for the target size and the height is flexible, so the height difference between 2137 and 4096 (which is the ad-hoc value) should not have been considered in the MemoryCacheService's isCacheValueValidForSize function.
In the current code, the cache is not valid simply because the Scale is FILL (because it was a FillWidth composable) but the height doesn't have what it needs to be able to FILL in both dimensions (width and height). Without the 4096 protections, this was addressed by having the target's height equals toInt.MAX_VALUE
Describe the solution you'd like
We should find a way to document that the 4096 is a max limit for composables and it should be treated like Int.MAX_VALUE for the sake of the cache qualification algorithm.
The text was updated successfully, but these errors were encountered:
vitorpamplona
changed the title
Improve cache re-use on FillWidth composables.
Improve cache re-use on FillWidth composables with Precision.INEXACT
Dec 28, 2024
Is your feature request related to a problem? Please describe.
I believe the
Output image dimensions are now enforced to be less than 4096x4096 to guard against accidental OOMs
feature added a side effect that is making the library miss memory caches and reloads from disk every time a composable with FillWidth and flexible height is used (say inside a LazyColumn). The log shows an error like:Memory cached image's size (1202, 2137) is smaller than the target size (1013, 4096)
. This cache should have been used because the image's width is appropriate for the target size and the height is flexible, so the height difference between 2137 and 4096 (which is the ad-hoc value) should not have been considered in the MemoryCacheService'sisCacheValueValidForSize
function.In the current code, the cache is not valid simply because the Scale is FILL (because it was a FillWidth composable) but the height doesn't have what it needs to be able to FILL in both dimensions (width and height). Without the
4096
protections, this was addressed by having the target's height equals toInt.MAX_VALUE
Describe the solution you'd like
We should find a way to document that the
4096
is a max limit for composables and it should be treated likeInt.MAX_VALUE
for the sake of the cache qualification algorithm.The text was updated successfully, but these errors were encountered: