Garbage collector singleton. More...
|typedef std::map< std::string, |
unsigned int >
|void||addCollectable (const GcResource *item)|
|Add an heap object to the list of managed collectables. |
|Run the collector, if worth it. |
|Run the collection cycle. |
|void||countCollectables (CollectablesCount &count) const|
|Count collectables. |
|static GC &||init (GcRoot &r)|
|Init the singleton instance using the given GcRoot. |
|static void||cleanup ()|
|static GC &||get ()|
|Get the singleton. |
Garbage collector singleton.
Instances of this class ( you' only use one, the singleton ) manage a list of heap pointers (collectables) deleting them when no more needed/reachable.
Reachability of them is detected starting from a list of "root" containers each one expected to provide a function to return all reachable object.
Each "collectable" objects is also expected to be a container itself.
|typedef std::map<std::string, unsigned int> gnash::GC::CollectablesCount|
|void gnash::GC::addCollectable||(||const GcResource *||item||)||
Add an heap object to the list of managed collectables.
The given object is expected not to be already in the list. Failing to do so would just decrease performances but might not be a problem. Anyway, an assertion will fail if adding an object twice.
|item||The item to be managed by this collector. Can't be NULL. The caller gives up ownerhip of it, which will only be deleted by this GC.|
|void gnash::GC::countCollectables||(||CollectablesCount &||count||)||const|
|static GC& gnash::GC::get||(||)||
Run the collection cycle.
Find all reachable collectables, destroy all the others.