2010/12/7 Adrian Olaru <[email protected]>: > Hi guys, > I have this code: > var a; > function init() { > a = new SomeObject("one"); > a.doSomething(); > a = new SomeObject("two"); > a.doSomething(); > } > init(); > a = null; > What happens with the first object created and assigned to a? It's this an > example of memory leaking, or will be garbage collected? > Now, I know about garbage collection and how is implemented in browser > (mark-and-sweep vs ref count (ie) ), but still, I wanna be sure. > Thanks.
It will be garbage collected. No memory leaks. Tim _______________________________________________ JSMentors mailing list [email protected] http://jsmentors.com/mailman/listinfo/jsmentors_jsmentors.com
