diff options
author | David Robillard <d@drobilla.net> | 2011-05-14 06:21:58 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-05-14 06:21:58 +0000 |
commit | b4745f2217a735b3b5ea2a163f79a90f1457a59f (patch) | |
tree | 6da3acd2855fff5dbdaa2db13d7222e809bdd8fa /src | |
parent | d4fbd62b86c0b1129fd66c4efe4bfb3b2e0ecb4f (diff) | |
download | resp-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')
-rw-r--r-- | src/gc.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
@@ -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; |