3 Replies Latest reply on Feb 5, 2007 12:07 AM by sf_dougco

    Memory Leak using XMLSocket

    sf_dougco
      Hi all,

      I have a simple example of opening a socket that receives information every 20-30 seconds and it works fine but I get a constant memory leak if I leave it running. I found someone else had this problem at http://www.actionscript.org/forums/showthread.php3?t=111750 but they did not seem to get a resolution. Any ideas?

      Here are the code snippets:

      public function openConnection():void {
      socket = new XMLSocket();
      socket.addEventListener(Event.CONNECT, onConnect);
      socket.addEventListener(DataEvent.DATA, onData);
      socket.connect("myhost", 61000);
      }

      public function onConnect(event:Event):void {
      trace ("socket connected");
      }
      public function onData(event:DataEvent):void {
      trace("got data");
      trace(event.data);
      var url:String = event.data.toString();
      var response:XML = new XML(event.data);
      trace(url);
      }