Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How much memory would a large list of images consume #3

Closed
adeolaex opened this issue Nov 27, 2020 · 2 comments · Fixed by #4
Closed

How much memory would a large list of images consume #3

adeolaex opened this issue Nov 27, 2020 · 2 comments · Fixed by #4

Comments

@adeolaex
Copy link

Would it be idle to enable in-memory cache in the init() function.

In my use case, I have a large list that grows as one scrolls to a certain length.
The growing mechanism uses the Provider package but it still causes the flickering when ever I add item to the imageList with Provider. Although as per the docs

The problem with this approach is the memory usage increase. We recommend use only with images in widgets that run setState(), to erase the flicker.

No idea how setState is being called.

To keep it simple, would it be safe to enable in-memory caching for a large list of images?
Any feedback would be appreciated.

@ChrisChV
Copy link
Member

Hi @adeolaex,
the amount of memory used depends on the length of your images. If there are many images or they are very heavy, it may happen that the application closes due to a memory error. It has happened to me and we currently have a similar problem.

Our solution is to place a configurable limit of images that are stored in memory. For example, If your list shows 6 images on the screen, then you can set the limit of images in memory to 6. Then only the last 6 images loaded would be in memory, which would be the ones on the screen, so if the status of the screen is updated, those images would not blink.

We are just starting to implement this solution #2

@adeolaex
Copy link
Author

Hey @ChrisChV.
Thanks for your feedback.

Yes I have experienced crashes like that in the past due to memory consumption.
Well I will have wait for #2 to be completed. In the mean time I will set the gaplessPlayback of the Image widget to true whilst using platform storage.

This seems to stop the flickering.

@ChrisChV ChrisChV linked a pull request Dec 12, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants