diff --git a/ChangeLog b/ChangeLog index 8d932256c3..0a7e377080 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Jun 15 17:48:42 2009 Yukihiro Matsumoto + + * gc.c (os_obj_of): invoke garbage collection before iteration, to + avoid accessing half recycled object references. [ruby-dev:38613] + Mon Jun 15 11:04:30 2009 Nobuyoshi Nakada * .gdbinit (rp, iseq): load dummy_gdb_enums on demand. diff --git a/gc.c b/gc.c index 74163bedb5..6d3c34e0bb 100644 --- a/gc.c +++ b/gc.c @@ -85,6 +85,7 @@ void *alloca (); int ruby_gc_debug_indent = 0; #undef GC_DEBUG +#define GC_DEBUG /* for GC profile */ #define GC_PROFILE_MORE_DETAIL 0 @@ -272,7 +273,7 @@ typedef struct RVALUE { struct RComplex complex; } as; #ifdef GC_DEBUG - char *file; + const char *file; int line; #endif } RVALUE; @@ -2392,6 +2393,7 @@ os_obj_of(rb_objspace_t *objspace, VALUE of) RVALUE *p, *pend; volatile VALUE v; + rb_garbage_collect(); i = 0; while (i < heaps_used) { while (0 < i && (uintptr_t)membase < (uintptr_t)heaps[i-1].membase)