Reputation: 6884
Let's say I have a function with a static property, for example:
function Test() {}
Test.someProp = bigObject;
I'm wondering if bigObject
will always be in memory or it will gc sometime?
Upvotes: 1
Views: 36
Reputation: 1210
It will never be collected as long as someProp
is alive (has a reference). If you delete Test.someProp
or delete or empty the whole Test
then it will be gCollected
Upvotes: 1