96 #if GNASH_GC_DEBUG > 2
97 log_debug(
_(
"Instance %p of class %s already reachable, "
98 "setReachable doing nothing"), (
void*)
this,
104 #if GNASH_GC_DEBUG > 2
105 log_debug(
_(
"Instance %p of class %s set to reachable, scanning "
106 "reachable resources from it"), (
void*)
this,
138 #if GNASH_GC_DEBUG > 1
139 log_debug(
_(
"Class %s didn't override the markReachableResources() "
153 mutable bool _reachable;
201 _resList.push_back(item); ++_resListSize;
203 #if GNASH_GC_DEBUG > 1
204 log_debug(
_(
"GC: collectable %p added, num collectables: %d"), item,
241 if (_resListSize < _lastResCount + _maxNewCollectablesCount) {
242 #if GNASH_GC_DEBUG > 1
243 log_debug(
_(
"GC: collection cycle skipped - %d/%d new resources "
244 "allocated since last run (from %d to %d)"),
245 _resListSize-_lastResCount, _maxNewCollectablesCount,
246 _lastResCount, _resListSize);
247 #endif // GNASH_GC_DEBUG
268 typedef std::list<const GcResource*> ResList;
271 void markReachable() {
272 #if GNASH_GC_DEBUG > 2
273 log_debug(
_(
"GC %p: MARK SCAN"), (
void*)
this);
275 _root.markReachableResources();
281 size_t cleanUnreachable();
285 size_t _maxNewCollectablesCount;
291 ResList::size_type _resListSize;
298 ResList::size_type _lastResCount;
300 #ifdef GNASH_GC_DEBUG
301 size_t _collectorRuns;
virtual void markReachableResources() const
Scan all GC resources reachable by this instance.
Definition: GC.h:136
std::map< std::string, unsigned int > CollectablesCount
Definition: GC.h:260
void addCollectable(const GcResource *item)
Add an object to the list of managed collectables.
Definition: GC.h:194
void fuzzyCollect()
Run the collector, if worth it.
Definition: GC.h:210
Abstract class to allow the GC to store "roots" into a container.
Definition: GC.h:55
bool isReachable() const
Return true if this object is marked as reachable.
Definition: GC.h:115
#define _(String)
Definition: log.h:44
virtual ~GcRoot()
Definition: GC.h:68
#define DSOEXPORT
Definition: dsodefs.h:55
void setReachable() const
Mark this resource as being reachable.
Definition: GC.h:92
virtual ~GcResource()
Delete this resource.
Definition: GC.h:149
void clearReachable() const
Clear the reachable flag.
Definition: GC.h:118
virtual void markReachableResources() const =0
Scan all GC resources reachable by this instance.
Garbage collector singleton.
Definition: GC.h:164
Collectable resource.
Definition: GC.h:74
GcResource(GC &gc)
Create a Garbage-collected resource associated with a GC.
Definition: GC.h:307
std::string typeName(const T &inst)
Definition: utility.h:93