3

I am concerned about memory leaks in my client-side javascript application.

in particular, I have objects which cross-reference each other.

var obj1 = new SomeObject();
var obj2 = new AnotherObject();
obj1.ref = obj2;
obj2.ref = obj1;

as the program runs, obj1 and obj2 are reset

obj1 = new SomeObject();
obj2 = new AotherObject();
obj1.ref = obj2;
obj2.ref = obj1;

the question is whether the original objects which were assigned to obj1 and obj2 will be garbage collected, or do they need to be deleted manually?

4

0 回答 0