Chinaunix首页 | 论坛 | 博客
  • 博客访问: 471615
  • 博文数量: 66
  • 博客积分: 2125
  • 博客等级: 大尉
  • 技术积分: 704
  • 用 户 组: 普通用户
  • 注册时间: 2005-03-08 13:42
个人简介

空气中的尘埃

文章分类

全部博文(66)

文章存档

2019年(1)

2017年(4)

2016年(2)

2015年(4)

2014年(4)

2013年(2)

2012年(5)

2011年(6)

2010年(9)

2009年(8)

2008年(12)

2007年(6)

2006年(2)

2005年(1)

我的朋友

分类: 系统运维

2009-09-03 14:57:50

 
某一页面每打开一次,内存增长一次。达到一定程度后,页面假死,无法继续打开页面。
 
打开窗口代码如下。
function openEditor(){  
 var args=openEditor.arguments;
 var MaxModalStyle = "status=1,scrollbars=1,width=" + (screen.width-15) + ",height=" + (screen.height-50) + ",left=0,top=10";
 dgEditor=window.open("dd.jsp?kzh="+args[0]+"&nf=2009","",MaxModalStyle);            
 return false;
}
 
考虑到和dgEditor对象没有释放代码有关系。代码修改为
var jdeditor = null;
function openEditor(){  
 var args=openEditor.arguments;
 var MaxModalStyle = "status=1,scrollbars=1,width=" + (screen.width-15) + ",height=" + (screen.height-50) + ",left=0,top=10";
 if(jdeditor!=null){
 try{  
 jdeditor.close(); 
 }catch(e2){
 }
 jdeditor = null;
 }
 jdeditor = window.open("dd.jsp?kzh="+args[0]","",MaxModalStyle);            
 return false;
}
 
使用drip 工具检测, 内存增长大大减少。
起作用的是 jeditor.close(); 一句。
下图为drip 工具监测
注释掉 jeditor.close() 打开新窗口并关闭后内存陡增,使用jeditor.close() 后,再打开新窗口关闭,内存平稳。
 
阅读(3122) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~