0 0

createElement('script')内存清理问题10

createElement('script')内存清理问题


function TxtCallback(str)
{

}

var Pos=[],Boxs=[];
function Loadlocdata(obj)
{
if(!obj||!obj.picxy)return;
var LN='3/'+obj.picxy;
var tempobj = document.createElement('script');
tempobj.type = 'text/javascript';
tempobj.id='jscom'+LN;
tempobj.charset="UTF-8";
var nowdate=new Date().getTime();
tempobj.src="maptxt/023/"+LN+".txt?"+nowdate;
document.body.appendChild(tempobj);
obj=null;
tempobj=null;

}

function DeleMapdata(Delesign){
//清除所有地图数据
for(var key in Pos)delete Pos[key];
Pos=[];

for(var key in Boxs)delete Boxs[key];
Boxs=[];


$(function(){
$("script[id*='jscom3']").each(
function(){
$(this).attr("src","").remove();
}
)

});
CollectGarbage();
}

for(var a=450;a<470;a++)
{
for(var b=400;b<420;b++)
{
Loadlocdata(
{picxy:a+"/"+b}

);


}
}

setTimeout(function(){
DeleMapdata("dele_all");
},500
)

txt里面文件内容大概如下:
Pos['3,450,400'] = [{"ID":4421,"Name":"\u658c\u946b\u80dc\u666f\u96c5\u82d1","Telephone":"0","Address":"“},{、、、、、},、、、、]
Boxs['3,450,400'] = [{"ID":4421,"Name":"\u658c\u946b\u80dc\u666f\u96c5\u82d1","Telephone":"0","Address":"”}、、、、、、、、]

根据条件使用这些数据后,对Pos、Boxs的数据和script标签进行删除

但内存好像还是没降下来?
2008年9月01日 17:21
目前还没有答案

相关推荐

Global site tag (gtag.js) - Google Analytics