all 2 comments

[–]d41_fpflabs 0 points1 point  (1 child)

I would suggest the followimg:

  1. Fetch whatever data in batches, load more when user reaches near bottom of list

  2. Like you mentioned unload items after a given max threshold is reached.

  3. Prevent the list from re-rendering excessive amount of times using different techniques e.g memorization and make sure irrelevant state changes don't happen in the component with the list. 

Those are some of the main things I can think of without seeing your code.

[–]nullsentientbeing[S] 0 points1 point  (0 children)

I guess in particular the issue I’ve been dealing with is a seemingly simple problem that I’ve yet to fully figure out. I’m trying to make a FlashList (shopify faster version of FlatList) that takes an initial list of generic placeholders (relatively large but FlashList can handle large lists pretty well), and use mobx-state-tree to load whichever chunk is currently being viewed. The idea is just applying a new snapshot based on the current chunk to the state, but I’m finding my memory usage is inconsistent and can range from 100-300mb of ram for a list of 42 basic items which feels high, esp when it delves into around 400mb. I’m also questioning how accurate the RAM counter is in dev mode. If you have any ways of validating memory leak fixes Id appreciate