aboutsummaryrefslogtreecommitdiffstats
path: root/src/gc.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-05-14 06:21:58 +0000
committerDavid Robillard <d@drobilla.net>2011-05-14 06:21:58 +0000
commitb4745f2217a735b3b5ea2a163f79a90f1457a59f (patch)
tree6da3acd2855fff5dbdaa2db13d7222e809bdd8fa /src/gc.cpp
parentd4fbd62b86c0b1129fd66c4efe4bfb3b2e0ecb4f (diff)
downloadresp-b4745f2217a735b3b5ea2a163f79a90f1457a59f.tar.gz
resp-b4745f2217a735b3b5ea2a163f79a90f1457a59f.tar.bz2
resp-b4745f2217a735b3b5ea2a163f79a90f1457a59f.zip
Don't garbage collect types that are stored in data structures in the compiler (partially fix REPL).
git-svn-id: http://svn.drobilla.net/resp/trunk@419 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/gc.cpp')
-rw-r--r--src/gc.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/gc.cpp b/src/gc.cpp
index e6a296b..6655e40 100644
--- a/src/gc.cpp
+++ b/src/gc.cpp
@@ -81,14 +81,22 @@ GC::collect(const Roots& roots)
Heap::iterator next = i;
++next;
- if ((*i)->marked()) {
- (*i)->mark(false);
- assert(!(*i)->marked());
- } else {
- tlsf_free((tlsf_t*)_pool, ((char*)(*i) - sizeof(Object::Header)));
- _heap.erase(i);
+ switch ((*i)->tag()) {
+ case T_UNKNOWN:
+ case T_TVAR:
+ case T_SYMBOL:
+ i = next;
+ continue;
+ default:
+ if ((*i)->marked()) {
+ (*i)->mark(false);
+ assert(!(*i)->marked());
+ } else {
+ tlsf_free((tlsf_t*)_pool, ((char*)(*i) - sizeof(Object::Header)));
+ _heap.erase(i);
+ }
+ i = next;
}
- i = next;
}
//std::cerr << "[GC] Collect " << oldSize << " => " << _heap.size() << endl;