首页 > 代码库 > 标记清除算法

标记清除算法

function mark(p, level){  if(level >3){     return ;  }  if(typeof p == "object" && p != null && p.marked == undefined){  p.marked = true;  console.log(p);    for(var prop in p){     mark(p[prop], level+1);  } }}var g1={name:"xiaoming"};function func1(){   return {name:"xiaohua"};}var l2 = func1();mark(window, 1);

标记清除算法