Garbage Collection

In DX8, DirectMusic introduced three features that could easily cause reference loops. These are Scripting, Script Tracks, and Segment Playback Tracks. For example, one script might reference another script that calls back into the first. On the other hand, a Segment Trigger Track triggers the same Segment or another that triggers the original Segment again. These are all perfectly reasonable scenarios, and they do load and run appropriately. However, when it comes time to clean up, a self-referencing loop keeps the reference counts of all objects in the loop incremented by at least one, and so they never go away, even though nothing actually references them outside the loop.

The CollectGarbage() method solves this problem. CollectGarbage() scans for all objects that have been completely released by the Loader as well as the application and calls an internal method on the object, forcing it to release its references to other objects and thus breaking any cyclic references and removing unneeded objects from memory.

DirectX 9 Audio Exposed(c) Interactive Audio Development
DirectX 9 Audio Exposed: Interactive Audio Development
ISBN: 1556222882
EAN: 2147483647
Year: 2006
Pages: 170
Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net