Memory leak in IE MS < 9

Any and all non-support discussions

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

Memory leak in IE MS < 9

Postby swirl » Fri Jun 20, 2014 3:56 am

My resolution of the virtual memory leak when use agent dashboard in IE MS < 9

Code: Select all
var xmlhttp=ms_getxmlobj();
ms_ajax_send(xmlhttp,method,url,data);

if(xmlhttp)
{
   xmlhttp.onreadystatechange = function()
   {
       if(xmlhttp != null)
               {
                   if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
                        {
         //var response = xmlhttp.responseText
          xmlhttp = null;
         }
      }
   }
}


function ms_getxmlobj()
{
                var xmlhttp=false;
                /*@cc_on @*/
                /*@if (@_jscript_version >= 5)
                // JScript gives us Conditional compilation, we can cope with old IE versions.
                // and security blocked creation of the objects.
                 try {
                  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
                 } catch (e) {
                  try {
                   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                  } catch (E) {
                   xmlhttp = false;
                  }
                 }
                @end @*/
                if (!xmlhttp && typeof XMLHttpRequest!='undefined')
                        {
                        xmlhttp = new XMLHttpRequest();
                        }
        return xmlhttp;
}

function ms_ajax_send(xmlhttp,method,url,data)
{
          xmlhttp.open(method,url);
          xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
          xmlhttp.send(data);
}


Example vici:
Code: Select all
function alert_control(taskalert)
{
        alert_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=AlertControl&format=text&stage=" + taskalert;

        var xmlhttp=ms_getxmlobj();
        ms_ajax_send(xmlhttp,'POST','manager_send.php',alert_query);

        if(xmlhttp)
        {
                xmlhttp.onreadystatechange = function()
                {
                        if(xmlhttp != null)
                        {
                                if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
                                {
                                        if (taskalert=='ON')
                                        {
                                                alert_enabled = 'ON';
                                                document.getElementById("AgentAlertSpan").innerHTML = "<a href=\"#\" onclick=\"alert_control('OFF');return false;\"><? echo $lang->get("Alert is ON"); ?></a>";
                                        }else{
                                                alert_enabled = 'OFF';
                                                document.getElementById("AgentAlertSpan").innerHTML = "<a href=\"#\" onclick=\"alert_control('ON');return false;\"><? echo $lang->get("Alert is OFF"); ?></a>";
                                        }
                                        xmlhttp = null;
                                }
                        }
                }
        }
}

swirl
 
Posts: 4
Joined: Fri Jun 20, 2014 3:00 am

Re: Memory leak in IE MS < 9

Postby mflorell » Fri Jun 20, 2014 6:28 am

Thank you for posting this, could you please start a new Issue Tracker ticket and link to it here?
mflorell
Site Admin
 
Posts: 18335
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida

Re: Memory leak in IE MS < 9

Postby swirl » Tue Jun 24, 2014 5:16 am

I can't post url.
Your post looks too spamy for a new user, please remove off-site URLs.
swirl
 
Posts: 4
Joined: Fri Jun 20, 2014 3:00 am

Re: Memory leak in IE MS < 9

Postby mflorell » Tue Jun 24, 2014 6:30 am

mflorell
Site Admin
 
Posts: 18335
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 57 guests