Sorry, 忘记写地址了
http://groups.google.com/group/ajaxpro/browse_thread/thread/614eaa13409becf/dd79b87d1375204c?lnk=st&q=AJAX+Memory+Leak%3F&rnum=1#dd79b87d1375204c
http://groups.google.com/group/ajaxpro/browse_thread/thread/614eaa13409becf/dd79b87d1375204c?lnk=st&q=AJAX+Memory+Leak%3F&rnum=1#dd79b87d1375204c
解决方案 »
- 使用jquery validate的时候无法触发 鼠标离开的时候进行验证?我设置了onfocusout为true.但是还是不行 。求教
- [十万火急]js脚本实现导航条效果小状况
- 总结下json数据格式和大家分享
- Html中Form的Action里获取变量 怎么获取?
- 求助以下问题如何用javascript表达 关于年月日及小数点问题
- 求救 for ......in
- 怎么获取主页面的控件属性
- JavaScript验证文本框输入问题
- 这个页面怎么做?????
- 原生js中的遇到this和ajax问题,无法解决
- 关于163.com 邮箱界面实现的问题.
- 使用 Javascript Obfuscator 时候,为什么不能更改函数名和变量名???
那个好多了
Michael,
I know why there are memory leaks in apps such as Chat (which I just
worked on using your Ajax.NET). I found it in the common.js that is
generated by the dll. There is a bug that causes NEW xmlhttprequests
to ALWAYS be added to the collection. The reason is that in
"ajax_create_request" the line that reads:
if(requests[i].readyState == 4)
should read:
if(requests[i].obj.readyState == 4)
and the line that reads:
requests[i].abort();
should read:
requests[i].obj.abort();
If not, the collection will NEVER find an "unused" request, and will
build a new instance of the XMLHttpRequest object for every single
call. I changed the code (see below) in common.js and I have no more
memory leak.
See the code diff below for the fix:
==================================
BEFORE:
function ajax_create_request(context)
{
for(var i=0; i<requests.length; i++)
{
if(requests[i].readyState == 4)
{
requests[i].abort();
requests[i].context = null;
return requests[i];
}
}
var pos = requests.length;
requests[pos] = Object();
requests[pos].obj = new XMLHttpRequest();
requests[pos].context = context;
return requests[pos]; }
====================
AFTER: function ajax_create_request(context)
{
for(var i=0; i<requests.length; i++)
{
if(requests[i].obj.readyState == 4)
{
requests[i].obj.abort();
requests[i].context = null;
return requests[i];
}
}
var pos = requests.length;
requests[pos] = Object();
requests[pos].obj = new XMLHttpRequest();
requests[pos].context = context;
return requests[pos]; 但谁知道哪有修正后的Ajax.dll可下载的?
但有谁有修正后的 Ajax.dll呢? 因为客户端的一个common.ashx,是Ajax.dll自动生成的,其中的js代码改不了. 谁知道的话给我发一份修正后Ajax.dll啊,不甚感谢. [email protected],
I know why there are memory leaks in apps such as Chat (which I just
worked on using your Ajax.NET). I found it in the common.js that is
generated by the dll. There is a bug that causes NEW xmlhttprequests
to ALWAYS be added to the collection. The reason is that in
"ajax_create_request" the line that reads:
if(requests[i].readyState == 4)
should read:
if(requests[i].obj.readyState == 4)
and the line that reads:
requests[i].abort();
should read:
requests[i].obj.abort();
If not, the collection will NEVER find an "unused" request, and will
build a new instance of the XMLHttpRequest object for every single
call. I changed the code (see below) in common.js and I have no more
memory leak.
See the code diff below for the fix:
==================================
BEFORE:
function ajax_create_request(context)
{
for(var i=0; i<requests.length; i++)
{
if(requests[i].readyState == 4)
{
requests[i].abort();
requests[i].context = null;
return requests[i];
}
}
var pos = requests.length;
requests[pos] = Object();
requests[pos].obj = new XMLHttpRequest();
requests[pos].context = context;
return requests[pos]; }
====================
AFTER: function ajax_create_request(context)
{
for(var i=0; i<requests.length; i++)
{
if(requests[i].obj.readyState == 4)
{
requests[i].obj.abort();
requests[i].context = null;
return requests[i];
}
}
var pos = requests.length;
requests[pos] = Object();
requests[pos].obj = new XMLHttpRequest();
requests[pos].context = context;
return requests[pos];