Jump to content
  • Advertisement
Sign in to follow this  
pTymN

[web] Flash CS4 circular reference problems

This topic is 3350 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, My paranoia is pretty high now regarding the fact that the Flash GC seems to completely leak any object with a circular reference, including a MovieClip who has a child or maybe somehow SoundChannels, due to a very naive reference counting algorithm. Here's some questions that I can't find detailed answers for: 1. When is the code from a closure generated? 2. When is the code from a closure garbage collected? 3. When are objects that are referred to from a dead closure garbage collected? 4. It seems like a very big oversight that a basic type of object like a MovieClip has exactly the kind of circular reference problem that the garbage collector chokes on when it contains an also unused child (parent and presumably hidden field children cause parent and child DisplayObjects to point to each other circularly). Do all experienced Flash developers already know this, or am I doing something really stupid in my AS3 code? 5. Eventually my game starts getting null return values from anySoundInstance.play(), but the game is able to play way more than 32 sounds (I have to run it for a few hours in an autoplay mode before I see the problem when I come back to my PC). My sound playing function sets up a sound.complete event (which removes itself from the SoundChannel when triggered) and returns a function that takes a fade out time in milliseconds and adjusts the channel's volume very 50 milliseconds. I'm wondering if closures can cause memory leaks. 6. I can't find any reference to the parent SoundChannel in SoundTransform or SoundChannels in Sound, so I really cannot find any circular references in the class heirarchy. If you have any insight, please share. For SoundChannels that come from soundInstance.play() calls, it seems that even though I null all references to that soundchannel, they do seem to eventually accumulate over time until all 32 are used up.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!