Tunes GC scheduling a bit to reduce memory usage.

The main problem was that GC was only called from the simulation before
this patch. This means when you were waiting in the multiplayer lobby or
just had the GUI open, it only called GC when getting close to the JS
runtime size limit (I assume). Another problem was the Net Server
runtime which didn't GC either. Here the runtime size limit is 16 MB
though, so it's not too terrible. These issues have both been addressed
and GC has been given a bit more time per incremental slice to make sure
it gets done in time. It's still far from perfect, but there are too
many changes in SpiderMonkey related to GC, so I don't want to spend too
much time on this yet.

Refs #2808

This was SVN commit r15787.
This commit is contained in:
Yves
2014-09-22 20:13:04 +00:00
parent 3f75e5db0e
commit 3b49576fa6
7 changed files with 63 additions and 25 deletions
+3 -2
View File
@@ -449,10 +449,11 @@ void CSimulation2Impl::Update(int turnLength, const std::vector<SimulationComman
// m_ComponentManager.GetScriptInterface().DumpHeap();
// Run the GC occasionally
// No delay because a lot of garbage accumulates in one turn and in non-visual replays there are
// much more turns in the same time than in normal games.
// (TODO: we ought to schedule this for a frame where we're not
// running the sim update, to spread the load)
if (m_TurnNumber % 1 == 0)
m_ComponentManager.GetScriptInterface().MaybeIncrementalRuntimeGC();
m_ComponentManager.GetScriptInterface().MaybeIncrementalRuntimeGC(0.0f);
if (m_EnableOOSLog)
DumpState();