[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11730: Split GC::collect into an in
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11730: Split GC::collect into an inlined GC::fuzzyCollect and unconditional GC::runCycle |
Date: |
Mon, 21 Dec 2009 22:24:46 +0100 |
User-agent: |
Bazaar (2.0.2) |
------------------------------------------------------------
revno: 11730
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Mon 2009-12-21 22:24:46 +0100
message:
Split GC::collect into an inlined GC::fuzzyCollect and unconditional
GC::runCycle
modified:
libbase/GC.cpp
libbase/GC.h
libcore/impl.cpp
libcore/movie_root.cpp
=== modified file 'libbase/GC.cpp'
--- a/libbase/GC.cpp 2009-12-21 20:30:28 +0000
+++ b/libbase/GC.cpp 2009-12-21 21:24:46 +0000
@@ -111,45 +111,8 @@
}
void
-GC::collect()
+GC::runCycle()
{
- // Heuristic to decide wheter or not to run the collection cycle
- //
- //
- // Things to consider:
- //
- // - Cost
- // - Depends on the number of reachable collectables
- // - Depends on the frequency of runs
- //
- // - Advantages
- // - Depends on the number of unreachable collectables
- //
- // - Cheaply computable informations
- // - Number of collectables (currently O(n) but can be optimized)
- // - Total heap-allocated memory (currently unavailable)
- //
- // Current heuristic:
- //
- // - We run the cycle again if X new collectables were allocated
- // since last cycle run. X defaults to maxNewCollectablesCount
- // and can be changed by user (GNASH_GC_TRIGGER_THRESHOLD env
- // variable).
- //
- // Possible improvements:
- //
- // - Adapt X (maxNewCollectablesCount) based on cost/advantage
- // runtime analisys
- //
-
- if ( _resListSize < _lastResCount + maxNewCollectablesCount )
- {
-#if GNASH_GC_DEBUG > 1
- log_debug(_("GC: collection cycle skipped - %d/%d new resources
allocated since last run (from %d to %d)"), _resListSize-_lastResCount,
maxNewCollectablesCount, _lastResCount, _resListSize);
-#endif // GNASH_GC_DEBUG
- return;
- }
-
//
// Collection cycle
//
=== modified file 'libbase/GC.h'
--- a/libbase/GC.h 2009-12-21 20:30:28 +0000
+++ b/libbase/GC.h 2009-12-21 21:24:46 +0000
@@ -245,12 +245,54 @@
#endif
}
-
- /// Run the collector
+ /// Run the collector, if worth it
+ void fuzzyCollect()
+ {
+ // Heuristic to decide wheter or not to run the collection cycle
+ //
+ //
+ // Things to consider:
+ //
+ // - Cost
+ // - Depends on the number of reachable collectables
+ // - Depends on the frequency of runs
+ //
+ // - Advantages
+ // - Depends on the number of unreachable collectables
+ //
+ // - Cheaply computable informations
+ // - Number of collectables (currently O(n) but can be optimized)
+ // - Total heap-allocated memory (currently unavailable)
+ //
+ // Current heuristic:
+ //
+ // - We run the cycle again if X new collectables were allocated
+ // since last cycle run. X defaults to maxNewCollectablesCount
+ // and can be changed by user (GNASH_GC_TRIGGER_THRESHOLD env
+ // variable).
+ //
+ // Possible improvements:
+ //
+ // - Adapt X (maxNewCollectablesCount) based on cost/advantage
+ // runtime analisys
+ //
+
+ if ( _resListSize < _lastResCount + maxNewCollectablesCount )
+ {
+#if GNASH_GC_DEBUG > 1
+ log_debug(_("GC: collection cycle skipped - %d/%d new resources
allocated since last run (from %d to %d)"), _resListSize-_lastResCount,
maxNewCollectablesCount, _lastResCount, _resListSize);
+#endif // GNASH_GC_DEBUG
+ return;
+ }
+
+ runCycle();
+ }
+
+ /// Run the collection cycle
//
/// Find all reachable collectables, destroy all the others.
///
- void collect();
+ void runCycle();
typedef std::map<std::string, unsigned int> CollectablesCount;
=== modified file 'libcore/impl.cpp'
--- a/libcore/impl.cpp 2009-11-13 23:21:54 +0000
+++ b/libcore/impl.cpp 2009-12-21 21:24:46 +0000
@@ -80,7 +80,7 @@
fontlib::clear();
#ifdef GNASH_USE_GC
- GC::get().collect();
+ GC::get().fuzzyCollect(); // why would this be needed ?
GC::cleanup();
#endif
=== modified file 'libcore/movie_root.cpp'
--- a/libcore/movie_root.cpp 2009-12-18 08:39:11 +0000
+++ b/libcore/movie_root.cpp 2009-12-21 21:24:46 +0000
@@ -271,7 +271,7 @@
cleanupUnloadedListeners();
cleanupDisplayList();
- GC::get().collect();
+ GC::get().fuzzyCollect();
}
/* private */
@@ -531,7 +531,7 @@
#ifdef GNASH_USE_GC
// Run the garbage collector again
- GC::get().collect();
+ GC::get().fuzzyCollect();
#endif
setInvalidated();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r11730: Split GC::collect into an inlined GC::fuzzyCollect and unconditional GC::runCycle,
Sandro Santilli <=