3 Replies Latest reply on Feb 6, 2007 2:17 AM by Lacito_Domingo

    HTTPService Memory Leak?

    FlightGuy Level 1
      Hi All - I posted this a little while ago on the AS3 forum, but perhaps this is a better place to get some feedback. I can't imagine I'm the first or only person to be polling a server with the HTTPService. Is anyone else doing this with or without the memory leak?

      I have an application that uses HTTPService to poll status on my server for changes. I've noticed that if I leave the client running indefinitely it eventually hangs my machine. Here is a simplified mxml application that demonstrates the problem. If I run this, either from IE 5.5 or from Firefox 2.0, and observe memory usage, it consumes between 8 and 16 kilobytes a second indefinitely.

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="setupTimer()">
      private function setupTimer():void{
      // Set up a timer to tick every second
      var myTimer:Timer = new Timer(1000);
      myTimer.addEventListener(TimerEvent.TIMER, timerHandler);


      private function timerHandler(event:TimerEvent):void{
      <mx:HTTPService id="leakyService" url=" http://www.google.com" resultFormat="text" result="trace('Result received');"/>

      I've tried creating the HTTPService in ActionScript, both as an instance variable (equivalent to this MXML example), and also as a local variable, so I'm creating a new HTTPService instance for each invocation. All gives the same result. Is there something I'm missing that I should be clearing up after each iteration? Anybody else encountered this problem?

      Is this intentional to encourage me to use Flex Data Services? Also, is there any way to report a bug (or suspected bug) on flex or ActionScript without having a support contract with Adobe? It would seem valuable at least to be able to search an issues list.
        • 1. Re: HTTPService Memory Leak?
          this behaviour does not reproduce on my pc. it will 'leak' some memory on every request for some time, then the memory usage stays the same. I guess at this point the garbage collector starts collecting as fast as new memory is allocated.

          I've change the code to access an url on my local http server ever 100ms, otherwise it's the same code.

          • 2. Re: HTTPService Memory Leak?
            FlightGuy Level 1
            Thanks for your feedback - I really appreciate the effort. I reran the test and get the same result as you did, but still get the memory leak in my application. So, I suspect it's something I'm doing with the result, but will post again once I have the answer. My apologies for suggesting it would be intentional - this is a great product.
            • 3. Re: HTTPService Memory Leak?
              Hello FlightGuy,

              Have you solved your memory leaking problem?

              Could you share your results?