summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-01 14:24:34 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-01 14:24:34 +0000
commit541dac0b9b664728ad07e4ea7ea7b7f5a3475147 (patch)
tree7f906e8bcddbc79a157d5a4fb96c105e072dccb5 /gc.c
parent21a58208f1342b9373aaab14e70c675461e1e764 (diff)
downloadruby-541dac0b9b664728ad07e4ea7ea7b7f5a3475147.tar.gz
gc.c: mark live objects only
* gc.c (wmap_mark_map): mark live objects only, but delete zombies. [ruby-dev:47787] [Bug #9069] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gc.c b/gc.c
index 6bc362b994..1f04ce507c 100644
--- a/gc.c
+++ b/gc.c
@@ -5302,7 +5302,10 @@ struct weakmap {
static int
wmap_mark_map(st_data_t key, st_data_t val, st_data_t arg)
{
- gc_mark_ptr((rb_objspace_t *)arg, (VALUE)val);
+ rb_objspace_t *objspace = (rb_objspace_t *)arg;
+ VALUE obj = (VALUE)val;
+ if (!is_live_object(objspace, obj)) return ST_DELETE;
+ gc_mark_ptr(objspace, obj);
return ST_CONTINUE;
}