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
解决方案 »
- 一个基础性问题。请指点。
- 关于在网页中处理frame事件的问题,高手来啊,很有挑战性!!!!
- 这个函数怎么用啊?能给个例子吗?谢谢,答完,给分。。。
- [在线]如何让pop窗口精确显示在一个文本框上?
- 图片大小问题
- 为什么通过一个js来提交表单如<a href="document.frm.submit();">提交</a>则表单from中onsubmit中js就不执行了
- 这种事件怎么抓
- window.close
- 用window.close()关闭窗口,如何使其不弹出确认的对话框
- 幫幫忙,2advanced.com的flash主頁,怎么将他下载到我的硬盘
- 关于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];