Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Basically you cannot manage memory in Flash/AIR. The memory is managed internally by the VM using MMgc.</p> <p><a href="https://developer.mozilla.org/en/MMgc" rel="nofollow">https://developer.mozilla.org/en/MMgc</a></p> <p>So basically the things you've begin to read are correct (sort of), you need to dereference objects completely to ensure that the garbage collector picks them up in it's next pass, the frequency of which is determined internally by the VM based on the performance of the system the VM is running on. As for the timer events I wouldn't say you need to remove/re-add the listener over and over, but perhaps stopping the event propagation within the event callback (e.stopImmediatePropagation()).</p> <p><a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/Event.html#stopImmediatePropagation" rel="nofollow">http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/Event.html#stopImmediatePropagation</a>()</p> <p>But all that's going to do is stop the event from being processed or bubbled anywhere else, and I don't imagine for a second that this is the cause of your memory leak. It's most likely somewhere that you're creating and destroying objects, or creating them and simply discarding them without actually properly destroying them. Below is a link to an article about tracking leaks in flash/AIR. It explains how this entire thing works from the actionscript side very well:</p> <p><a href="http://divillysausages.com/blog/tracking_memory_leaks_in_as3" rel="nofollow">http://divillysausages.com/blog/tracking_memory_leaks_in_as3</a></p> <p>If you run through that article, then review your code and narrow it down to what you think is the issue but are not sure, update your quesiton with some code snippets and I'll update my answer to address whatever you post. :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. COPerhaps one instance where the event received in the timer could be the cause of the leak is if you were to capture and hold an object reference from the event. For example you referenced e.currentTarget but created a local or class level reference to the event current dispatcher (the current target). Then, perhaps flash will retain the copy of that event because you're indirectly referencing it's parent or dispatcher through itself. Not sure, just an idea but one that would require some test cases to prove/disprove.
      singulars
      1. This table or related slice is empty.
    2. COThanks. I will go through the links you provided. Meanwhile here's a part of my code: private var service:HTTPService; private function init() :void { service = new HTTPService(); service.method = "GET"; service.url = serviceUrl; service.addEventListener(ResultEvent.RESULT, httpResult); service.addEventListener(FaultEvent.FAULT, httpFault); }
      singulars
    3. COThanks. I will go through the links you provided. Meanwhile here's a part of my code: private var service:HTTPService; private function init() :void { service = new HTTPService(); service.method = "GET"; service.url = serviceUrl; service.addEventListener(ResultEvent.RESULT, httpResult); service.addEventListener(FaultEvent.FAULT, httpFault); callhttpService(); pingTimer = new Timer(pingInterval,0); pingTimer.addEventListener(TimerEvent.TIMER,timer_dothis);} private function callhttpService():void { service.send();} private function timer_dothis(evt:TimerEvent):void { callhttpService(); }
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload