javascript - Will an object referenced within an object get garbage collected? -


var = {     b: "this"; };  = null; 

when removing reference object literal 'a' referencing in beginning, reference "this" removed well, or cause memory leak?

do have change code this:

delete a.b; = null; 

?

this not cause memory leak. garbage collector typically works walking set of live references, marking set of objects finds , collecting didn't see. in case neither value assigned a or literal "this" found , both eligible collection


Comments