diff options
author | rubidium <rubidium@openttd.org> | 2009-02-03 22:42:42 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-02-03 22:42:42 +0000 |
commit | 1c30c8c801d2b4ecc6901069dcdfa8d0411aa1fd (patch) | |
tree | 4f0ff072e810fbda1bd6a01083ab7be1081bfdf3 /src/script | |
parent | 101f55e65cd43daea211b26b5fe5666968a507f4 (diff) | |
download | openttd-1c30c8c801d2b4ecc6901069dcdfa8d0411aa1fd.tar.xz |
(svn r15330) -Fix [FS#2597]: leaking of Squirrel when using circular references (by enabling the GC).
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/squirrel.cpp | 5 | ||||
-rw-r--r-- | src/script/squirrel.hpp | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/script/squirrel.cpp b/src/script/squirrel.cpp index 26196292c..1400eaf0a 100644 --- a/src/script/squirrel.cpp +++ b/src/script/squirrel.cpp @@ -175,6 +175,11 @@ bool Squirrel::Resume(int suspend) return this->vm->_suspended != 0; } +void Squirrel::CollectGarbage() +{ + sq_collectgarbage(this->vm); +} + bool Squirrel::CallMethod(HSQOBJECT instance, const char *method_name, HSQOBJECT *ret, int suspend) { /* Store the stack-location for the return value. We need to diff --git a/src/script/squirrel.hpp b/src/script/squirrel.hpp index 39357bade..fc7472e96 100644 --- a/src/script/squirrel.hpp +++ b/src/script/squirrel.hpp @@ -101,6 +101,11 @@ public: */ bool Resume(int suspend = -1); + /** + * Tell the VM to do a garbage collection run. + */ + void CollectGarbage(); + void InsertResult(bool result); void InsertResult(int result); |