* gc.c (rb_objspace_free): With our "lazy-sweep" GC engine, it is

possible for an object to survive until its surrounding object
  space is about to be freed.  Those objects, if any, remains not
  leaked for the rest of a process life.  This is problematic
  because for instance a T_DATA object may have its own destructor
  to terminate something.

* vm.c (ruby_vm_destruct): ruby_current_vm termination should be
  somewhere after rb_objspace_free for above reason.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30065 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shyouhei 2010-12-03 03:53:21 +00:00
Родитель adc978adc3
Коммит 9d3ba342c9
3 изменённых файлов: 21 добавлений и 3 удалений

Просмотреть файл

@ -1,3 +1,15 @@
Fri Dec 3 12:41:52 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
* gc.c (rb_objspace_free): With our "lazy-sweep" GC engine, it is
possible for an object to survive until its surrounding object
space is about to be freed. Those objects, if any, remains not
leaked for the rest of a process life. This is problematic
because for instance a T_DATA object may have its own destructor
to terminate something.
* vm.c (ruby_vm_destruct): ruby_current_vm termination should be
somewhere after rb_objspace_free for above reason.
Fri Dec 3 12:17:19 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* vm_insnhelper.c (vm_call_method): protected singleton methods should

6
gc.c
Просмотреть файл

@ -400,9 +400,15 @@ rb_objspace_alloc(void)
return objspace;
}
static void gc_sweep(rb_objspace_t *);
static void slot_sweep(rb_objspace_t *, struct heaps_slot *);
static void gc_clear_mark_on_sweep_slots(rb_objspace_t *);
void
rb_objspace_free(rb_objspace_t *objspace)
{
gc_clear_mark_on_sweep_slots(objspace);
gc_sweep(objspace);
if (objspace->profile.record) {
free(objspace->profile.record);
objspace->profile.record = 0;

6
vm.c
Просмотреть файл

@ -1545,14 +1545,14 @@ ruby_vm_destruct(rb_vm_t *vm)
st_free_table(vm->living_threads);
vm->living_threads = 0;
}
rb_vm_gvl_destroy(vm);
ruby_xfree(vm);
ruby_current_vm = 0;
#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
if (objspace) {
rb_objspace_free(objspace);
}
#endif
rb_vm_gvl_destroy(vm);
ruby_xfree(vm);
ruby_current_vm = 0;
}
RUBY_FREE_LEAVE("vm");
return 0;