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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -