3 Replies Latest reply on Sep 29, 2010 9:49 AM by Flex harUI

    Memory Leak while calling HTTPService

    xxael

      Hi everybody,

       

      i am building Flex application and encounterd a problem.

      If i call the send Method of the HTTPService function sequently, the memory and size of the flash application is rising and rising.

      I watched it with the Flash Profiler and found out that the instances of DirectHTTPMessageResponder are rising and rising. The strange thing is, that in Flash Profiler the Garbage Collection triggers periodically and clean this instances. But if i call the application in debug or release mode, the size is rising and never fall back.

       

       

      Here is the example of my code:

       

      if(!mHttpService){
                      mHttpService = new HTTPService();
                      mHttpService.url = mWebServiceUrl;
                      mHttpService.addEventListener("result", httpResult);
                      mHttpService.addEventListener("fault", httpFault);
                  }
                   if (mHttpService)
                   {
                       var request:Object = new Object();

                       request.text = 1;

                   }

                   mHttpService.cancel();
                   mHttpService.send(request);

       

       

      private function httpResult(e:ResultEvent):void
              {   
                  if(mHttpService){
                      mHttpService.disconnect();
                      mHttpService.removeEventListener("result", httpResult);
                      mHttpService.removeEventListener("fault", httpFault);
                      mHttpService = null;
                  }

                 //Dispatch a Event
                  var f:IdManagerError = new IdManagerError("back", "now i am back from request");
                  dispatchEvent(f);
                  trace("in");
              }

       

      When the Event is dispatched i do a new request. So the request are done sequently(in average every second).

       

      Does anybody encounterd the same problem? And is there a solution for  this. Or do i something wrong?

       

      Please this is very urgent.

       

      Thanks in advance

       

      xxael