SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Employed Again Viflux's Avatar
    Join Date
    May 2003
    Location
    London, On.
    Posts
    1,130
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    XMLHTTPRequest Help (Kind of!)

    Ok, so I wrote a nice little chat application in Javascript, using the XMLHTTPRequest object.

    Anyways, it works like a charm in Firefox.

    Internet Explorer however, exhibits a memory leak.

    I assume that since my knowledge of JS is rather limited, I'm going about things in an inefficient manner.

    Code:
    if( requestObject.responseText != '' )
    	        {
    	            newDiv = document.createElement( 'span' );
    	            newDiv.innerHTML = requestObject.responseText;
    	            messageItem = document.getElementById('chat');
    	            messageItem.appendChild( newDiv );
    	            messageItem.scrollTop = messageItem.scrollHeight;
    	            
    	            newDiv = null;
    	            messageItem = null;
    	            requestObject = null;
    	            
    	            return;
    	        }
    Is used to add chat messages to the chat div.

    Code:
    if( requestObject.responseText != '' )
    	        {
    	            newList = document.createElement( 'ul' );
    	            newList.innerHTML = requestObject.responseText;
    	            userList = document.getElementById( 'users' );
    	            userList.innerHTML = '';
    	            userList.appendChild( newList );
    	            
    	            newList = null;
    	            userList = null;
    	            requestObject = null;
    	            
    	            return;
    	        }
    Is my code for updating a list of current users.

    Again, everything works lovely in Firefox.

    Does anyone see anything that would cause memory leaks in IE? Or is the leak likely to be somewhere else?

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does anyone see anything that would cause memory leaks in IE?
    See if you gain any insight here:

    http://www.quirksmode.org/blog/archi...aks/index.html


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •