Behaviour of custom states from a memory point of view

I am building out my single page app and the tab memory usage is crazy high (1.5 GB+). I am going back through and trying to find where this issue is occurring and I have one guess but I need some clarification on how custom states work in bubble, memory wise.

This is my setup:
I make an api call to the wordpress api which returns a list of json objects (specifically a list of articles and all associated meta data). I display this list of article objects in a RG. The user can then click on any 1 or more of the cells in this RG and every time they do, this appends an article to a custom state (whose data type is a list of these articles).

Like so:

My question is, does this double up the articles (json object) in memory? If I do the same thing in javascript (this applies only to lists of objects) then the second list is only a reference to the first list and the amount of additional memory used up is negligible.

So, in short, do bubble custom states operate the way javascript list of objects do or are they memory inefficient and double things up?

Thanks
Paul

As far as I can tell when you dispatch a new state, you replace the entire state, you’re not mutating the original state. When this occurs the garage collector is slow as heck to purge those leftover bits from the memory. It’s a problem. Bubble won’t acknowledge it last I tried to bring this up and they blamed it on my code.

1 Like

Yes, I guess I should have thought of that as a way to determine the answer to my question.

Thanks for your help.