views:

15

answers:

2
              cam = Camera.getCamera(0);
              vid1.attachCamera(cam);

              cam = Camera.getCamera(1);
               vid1.attachCamera(cam);

At the time when Camera.getCamera(1) is attached to vid1, is Camera.getCamera(0) destroyed internally or still in memory?

How to verify that?

A: 

In Flash, any object that has no reference pointing to it left, is subject to being garbage collected. There is no warranty that it will be garbage collected however.

So depending on how Camera works internally, it might be subject to gc in your case.

poke
A: 

Short answer: Garbage collection may happen at any time and you have no way of knowing when and no control over the process. You should not rely on it because it is entirely unpredictable. It may happen right now, it may happen seconds or minutes from now. For more information you might want to read Understanding garbage collection in Flash Player 9

You may find System.totalMemory useful in telling you something about your resources, e.g. determining when garbage is collected. The same writer mentions it in another article, Resource management strategies in Flash Player 9. See halfway down the page.

Axidos