2021年3月27日星期六

Copy memory address of list JavaScript

I have a userdata object in my database that is fetched on website load.
The user data could be up to multiple megabytes.
For the purposes of cleaner code and organization I would like to do the following:
Get all user data into object
Store some children of this user data object into separate lists
However, I wouldn't want to duplicate this data multiple times when it could be so large and have a mild impact on client ram.
I know javascript will often times just copy the memory address of a list when you set it so all I want to know is if that will actually happen?
For example does:
list = object.child;
Create a copy of that object in memory or just reference the already existing data? Is there anything special I have to do to ensure this?

https://stackoverflow.com/questions/66837569/copy-memory-address-of-list-javascript March 28, 2021 at 09:05AM

没有评论:

发表评论