From b4745f2217a735b3b5ea2a163f79a90f1457a59f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 14 May 2011 06:21:58 +0000 Subject: 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 --- src/gc.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'src/gc.cpp') 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; -- cgit v1.2.1