Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1036961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:47:22+00:00 2026-05-16T14:47:22+00:00

apologies if this is a dupe; i couldn’t find it. i’ve read and understood

  • 0

apologies if this is a dupe; i couldn’t find it.

i’ve read and understood grant skinner’s blog on the AS3 garbage collector –
http://www.adobe.ca/devnet/flashplayer/articles/garbage_collection.html ,
but my question isn’t covered there.

here’s my question.

suppose i’ve written some AS3 code like:

statementOne;
statementTwo;

is there any possibility that the garbage collector will run during or between my two statements, or does it only run after my “user” code has finished and returned control up to flash ?

we have an A-Star codeblock that’s sometimes slow,
and i’d like to eliminate the GC as a potential culprit.
the codeblock is obviously more complex than my example above,
but it doesn’t involve any events or other asynchronous stuff.

tia,
Orion

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T14:47:23+00:00Added an answer on May 16, 2026 at 2:47 pm

    There are many good answers here but I think a few subtleties have not been addressed.

    1. The Flash player implements two kinds of garbage collection. One is reference counting, where Flash keeps a count of the incoming references to each object, and knows that when the count reaches zero the object can be freed. The second method is mark-sweep, where Flash occasionally searches for and deletes isolated groups of objects (where the objects refer to one another, but the group as a whole has no incoming references).
    2. As a matter of specification either kind of garbage collection may occur at any time. The player makes no guarantee of when objects will be freed, and mark-sweeps may even be spread out over several frames. Further, there’s no guarantee that the timing of GCs will stay the same between Flash player versions, or platforms, or even browsers. So in a way, it’s not very useful to know anything about how GCs are triggered, as you have no way of knowing how widely applicable your knowledge is.
    3. Previous point aside, generally speaking mark-sweeps are infrequent, and only triggered in certain circumstances. I know of certain player/OS configurations where a mark/sweep could be triggered every N seconds, or whenever the player exceeded P% of the total available memory, but this was a long time ago and the details will have changed. Reference-counting GCs, in contrast, can happen frequently – between frames, at least. I don’t think I’ve seen them demonstrated to happen more frequently, but that doesn’t mean it can’t occur (at least in certain situations).

    Finally, a word about your specific issue: in my experience it’s very unlikely that the GC has anything to do with your performance problem. Reference-counted GC processing may well occur during your loops, but generally this is a good thing – this kind of collection is extremely fast, and keeps your memory usage manageable. The whole point of managing your references carefully is to ensure that this kind of GC happens in a timely manner.

    On the other hand, if a mark/sweep occurs during your loops, that would certainly affect your performance. But this is relatively hard to mistake and easy to test. If you’re testing on a PC and your application doesn’t regularly climb into the hundreds of MBs of memory usage (test with System.totalMemory), you’re probably not getting any mark/sweeps at all. If you do have them, it should be easy to verify that the associated pauses are large, infrequent, and always accompanied by a big drop in memory usage. If those things aren’t true, you can disregard the idea that GC is part of your problems.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First off, apologies if this question has been asked before but I couldn't find
Apologies if this is a repost, I could not find the search terms to
Apologies if this is a duplicate, but I've not managed to find this question
I am just getting started with IoC containers so apologies if this is a
I am just checking out F#, so apologies if this is a silly question,
I'm a student of web development (and college), so my apologies if this comes
Greetings, Apologies in advance that I have not researched this toughly enough to answer
Final question for the night. And apologies for the complete noobness of this. I
I apologize if this is slightly off-topic. I'm hoping to find a software-as-a-service CRM
First, apologies,this should be simple but I've had too much coffee and cannot wrap

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.