зеркало из https://github.com/github/ruby.git
* gc.c (id2ref): unmarked object is already dead while lazy
sweeping, and to it cannot come back since other objects referred from it might have been freed already. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
e3532c8bde
Коммит
4fe51cb330
|
@ -1,3 +1,9 @@
|
|||
Thu Sep 8 07:33:12 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* gc.c (id2ref): unmarked object is already dead while lazy
|
||||
sweeping, and to it cannot come back since other objects
|
||||
referred from it might have been freed already.
|
||||
|
||||
Wed Sep 8 03:48:00 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
|
||||
|
||||
* ext/readline/README.ja:
|
||||
|
|
5
gc.c
5
gc.c
|
@ -390,6 +390,8 @@ int *ruby_initial_gc_stress_ptr = &rb_objspace.gc_stress;
|
|||
#define global_List objspace->global_list
|
||||
#define ruby_gc_stress objspace->gc_stress
|
||||
|
||||
#define is_lazy_sweeping(objspace) ((objspace)->heap.sweep_slots != 0)
|
||||
|
||||
static void rb_objspace_call_finalizer(rb_objspace_t *objspace);
|
||||
|
||||
#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
|
||||
|
@ -3130,7 +3132,8 @@ id2ref(VALUE obj, VALUE objid)
|
|||
BUILTIN_TYPE(ptr) > T_FIXNUM || BUILTIN_TYPE(ptr) == T_ICLASS) {
|
||||
rb_raise(rb_eRangeError, "%p is not id value", p0);
|
||||
}
|
||||
if (BUILTIN_TYPE(ptr) == 0 || RBASIC(ptr)->klass == 0) {
|
||||
if (BUILTIN_TYPE(ptr) == 0 || RBASIC(ptr)->klass == 0 ||
|
||||
(is_lazy_sweeping(objspace) && !(RBASIC(ptr)->flags & FL_MARK))) {
|
||||
rb_raise(rb_eRangeError, "%p is recycled object", p0);
|
||||
}
|
||||
return (VALUE)ptr;
|
||||
|
|
Загрузка…
Ссылка в новой задаче