Bug #2493 ยป rubygc.patch
../ruby-svn/ruby_1_8_7/gc.c 2009-12-17 12:05:07.581225431 -0600 | ||
---|---|---|
break; /* no need to free iv_tbl */
|
||
/* BAB change for case T_SCOPE --
|
||
don't free anything that's not SCOPE_MALLOC. I'm not certain this is
|
||
correct, but a thread context switch allocated info that was
|
||
SCOPE_DONT_RECYCLE but not SCOPE_MALLOC, and freeing it caused a
|
||
double free problem. The original allocation was here :
|
||
rb_thread_start_0
|
||
blk_copy_prev
|
||
frame_dup
|
||
I think that a later copy had SCOPE_DONT_RECYCLE w/o SCOPE_MALLOC, which I'm taking to
|
||
mean that it shouldn't be freed. I don't understand everything, but I
|
||
checked and SCOPE_MALLOC is almost always set when calling into here
|
||
so not freeing w/o SCOPE_MALLOC should be liveable (at least for us)
|
||
*/
|
||
case T_SCOPE:
|
||
if (RANY(obj)->as.scope.local_vars &&
|
||
(RANY(obj)->as.scope.flags & SCOPE_MALLOC)) {
|
||
if(!(RANY(obj)->as.scope.flags & SCOPE_CLONE)) {
|
||
VALUE *vars = RANY(obj)->as.scope.local_vars-1;
|
||
if(vars[0] == 0) {
|
||
RANY(obj)->as.scope.flags != SCOPE_ALLOCA) {
|
||
VALUE *vars = RANY(obj)->as.scope.local_vars-1;
|
||
if (!(RANY(obj)->as.scope.flags & SCOPE_CLONE) && vars[0] == 0)
|
||
RUBY_CRITICAL(free(RANY(obj)->as.scope.local_tbl));
|
||
}
|
||
RUBY_CRITICAL(free(vars));
|
||
}
|
||
if ((RANY(obj)->as.scope.flags & (SCOPE_MALLOC|SCOPE_CLONE)) == SCOPE_MALLOC)
|
||
RUBY_CRITICAL(free(vars));
|
||
}
|
||
break;
|