[jboss-user] [JBoss Seam] - Seam Remoting - JavaScript memory useage problem?
pgmjsd
do-not-reply at jboss.com
Tue Apr 24 14:06:43 EDT 2007
I've notice that Firefox causes my machine to thrash when I leave a page that has Seam Remoting JavaScript running for a long period of time (say, 12 hours). I read ( http://www.jackslocum.com/blog/2006/10/02/3-easy-steps-to-avoid-javascript-memory-leaks ) that it is a good idea to set XMLHttpRequest onreadystatechange handlers to null when you are done with them, but it looks like remote.js doesn't do this.
The sendAjaxRequest function sets onreadystate change here:
Seam.Remoting.sendAjaxRequest = function(envelope, path, callback, silent)
| {
| Seam.Remoting.log("Request packet:\n" + envelope);
|
| if (!silent)
| Seam.Remoting.displayLoadingMessage();
|
| var asyncReq;
|
| if (window.XMLHttpRequest)
| {
| asyncReq = new XMLHttpRequest();
| if (asyncReq.overrideMimeType)
| asyncReq.overrideMimeType('text/xml');
| }
| else
| asyncReq = new ActiveXObject("Microsoft.XMLHTTP");
|
| asyncReq.onreadystatechange = function() {Seam.Remoting.requestCallback(asyncReq, callback); }
| asyncReq.open("POST", Seam.Remoting.resourcePath + path, true);
| asyncReq.send(envelope);
| return asyncReq;
| }
but it is not set to null here:
| Seam.Remoting.requestCallback = function(req, callback)
| {
| if (req.readyState == 4)
| {
| Seam.Remoting.hideLoadingMessage();
|
| if (req.status == 200)
| {
| Seam.Remoting.log("Response packet:\n" + req.responseText);
|
| if (callback)
| callback(req.responseXML);
| }
| else
| alert("There was an error processing your request. Error code: " + req.status);
| }
| }
|
Do you think that maybe setting onreadystatechange to null would help with this memory problem?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4040294#4040294
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4040294
More information about the jboss-user
mailing list