Lets say you have the following complex object:
var object1 = .... // (something complexed)
This takes up x
amount of memory in your JS application. Now lets say you have some other objects that reference object1
:
var otherObject = { something: true, value: 'yes', object: object1 };
var anotherObject = { color: '#FFF', object: object1 };
Have I tripled the amount of memory that object1
originally took up? Or do the references to object1
not add to the overhead of the memory used?
I'm not sure how to test this myself in order to determine the answer. (Bonus points if you can tell me how to point me to a tool that helps benchmark this).