aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorWalter van Niftrik2010-02-06 12:50:50 +0000
committerWalter van Niftrik2010-02-06 12:50:50 +0000
commit742ddb7979e0958adb1bb7944bf450da964df6a9 (patch)
treef1b2d9428cf665ae584eb8d24e00ffcdf7b6f756 /engines/sci/engine
parentb2e8777e1e09f13d89bea58156692c5ba2e4a733 (diff)
downloadscummvm-rg350-742ddb7979e0958adb1bb7944bf450da964df6a9.tar.gz
scummvm-rg350-742ddb7979e0958adb1bb7944bf450da964df6a9.tar.bz2
scummvm-rg350-742ddb7979e0958adb1bb7944bf450da964df6a9.zip
SCI: Run GC only when execution_stack_base is 0.
svn-id: r47929
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/vm.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 67f2fa13ea..a7aeecee05 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -569,8 +569,16 @@ static reg_t pointer_add(EngineState *s, reg_t base, int offset) {
static void gc_countdown(EngineState *s) {
if (s->gc_countdown-- <= 0) {
- s->gc_countdown = script_gc_interval;
- run_gc(s);
+ // Only run garbage collection when execution stack base
+ // is zero, as it cannot count references inside kernel
+ // functions
+ if (s->execution_stack_base == 0) {
+ s->gc_countdown = script_gc_interval;
+ run_gc(s);
+ } else {
+ // Try again later
+ s->gc_countdown = 1;
+ }
}
}