* gc.c (gc_sweep): loosen page free condition to avoid add_heap()

race condition. [ruby-dev:21633]

* gc.c (gc_sweep): do not update malloc_limit when malloc_increase
  is smaller than malloc_limit.

* ext/socket/socket.c (make_hostent): h_aliases may be NULL.
  (ruby-bugs PR#1195)

* ext/socket/socket.c (sock_s_gethostbyaddr): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2003-10-20 02:06:42 +00:00
Родитель 0014687097
Коммит e75c34c2e9
4 изменённых файлов: 42 добавлений и 21 удалений

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

@ -1,3 +1,11 @@
Mon Oct 20 11:00:46 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* gc.c (gc_sweep): loosen page free condition to avoid add_heap()
race condition. [ruby-dev:21633]
* gc.c (gc_sweep): do not update malloc_limit when malloc_increase
is smaller than malloc_limit.
Mon Oct 20 09:45:12 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* lib/debug.rb (debug_command): remove debug print.
@ -53,10 +61,17 @@ Fri Oct 17 11:15:22 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* MANIFEST: add test/ruby/test_range.rb.
Fri Oct 17 03:21:23 2003 William Sobel <will.sobel@barra.com>
* ext/socket/socket.c (make_hostent): h_aliases may be NULL.
(ruby-bugs PR#1195)
* ext/socket/socket.c (sock_s_gethostbyaddr): ditto.
Fri Oct 17 00:12:41 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk.rb: (bug fix) instance variable @frame was used
without initializing on TkComposite module
without initializing on TkComposite module.
Thu Oct 16 23:51:04 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>

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

@ -1046,8 +1046,10 @@ make_hostent(addr, ipaddr)
#else
h = gethostbyname(addr->ai_canonname);
#endif
for (pch = h->h_aliases; *pch; pch++) {
rb_ary_push(names, rb_str_new2(*pch));
if (h->h_aliases != NULL) {
for (pch = h->h_aliases; *pch; pch++) {
rb_ary_push(names, rb_str_new2(*pch));
}
}
#if defined(HAVE_GETIPNODEBYNAME)
freehostent(h);
@ -2022,8 +2024,10 @@ sock_s_gethostbyaddr(argc, argv)
rb_ary_push(ary, rb_str_new2(h->h_name));
names = rb_ary_new();
rb_ary_push(ary, names);
for (pch = h->h_aliases; *pch; pch++) {
rb_ary_push(names, rb_str_new2(*pch));
if (h->h_aliases != NULL) {
for (pch = h->h_aliases; *pch; pch++) {
rb_ary_push(names, rb_str_new2(*pch));
}
}
rb_ary_push(ary, INT2NUM(h->h_addrtype));
#ifdef h_addr

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

@ -969,7 +969,7 @@ gc_sweep()
}
p++;
}
if (n == heaps[i].limit && freed + n > FREE_MIN) {
if (n == heaps[i].limit && freed > FREE_MIN) {
RVALUE *pp;
heaps[i].limit = 0;
@ -982,8 +982,10 @@ gc_sweep()
freed += n;
}
}
malloc_limit += (malloc_increase - malloc_limit) * (double)live / (live + freed);
if (malloc_limit < GC_MALLOC_LIMIT) malloc_limit = GC_MALLOC_LIMIT;
if (malloc_increase > malloc_limit) {
malloc_limit += (malloc_increase - malloc_limit) * (double)live / (live + freed);
if (malloc_limit < GC_MALLOC_LIMIT) malloc_limit = GC_MALLOC_LIMIT;
}
malloc_increase = 0;
if (freed < FREE_MIN) {
add_heap();

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

@ -952,11 +952,11 @@ path2module(path)
}
static VALUE
r_object0(arg, proc, ivp, extended)
r_object0(arg, proc, ivp, extmod)
struct load_arg *arg;
VALUE proc;
int *ivp;
VALUE extended;
VALUE extmod;
{
VALUE v = Qnil;
int type = r_byte(arg);
@ -975,7 +975,7 @@ r_object0(arg, proc, ivp, extended)
{
int ivar = Qtrue;
v = r_object0(arg, 0, &ivar, extended);
v = r_object0(arg, 0, &ivar, extmod);
if (ivar) r_ivar(v, arg);
}
break;
@ -984,12 +984,12 @@ r_object0(arg, proc, ivp, extended)
{
VALUE m = path2module(r_unique(arg));
if (NIL_P(extended)) extended = rb_ary_new2(0);
rb_ary_push(extended, m);
if (NIL_P(extmod)) extmod = rb_ary_new2(0);
rb_ary_push(extmod, m);
v = r_object0(arg, 0, 0, extended);
while (RARRAY(extended)->len > 0) {
m = rb_ary_pop(extended);
v = r_object0(arg, 0, 0, extmod);
while (RARRAY(extmod)->len > 0) {
m = rb_ary_pop(extmod);
rb_extend_object(v, m);
}
}
@ -1002,7 +1002,7 @@ r_object0(arg, proc, ivp, extended)
if (FL_TEST(c, FL_SINGLETON)) {
rb_raise(rb_eTypeError, "singleton can't be loaded");
}
v = r_object0(arg, 0, 0, extended);
v = r_object0(arg, 0, 0, extmod);
if (rb_special_const_p(v) || TYPE(v) == T_OBJECT || TYPE(v) == T_CLASS) {
format_error:
rb_raise(rb_eArgError, "dump format error (user class)");
@ -1206,9 +1206,9 @@ r_object0(arg, proc, ivp, extended)
VALUE data;
v = rb_obj_alloc(klass);
if (! NIL_P(extended)) {
while (RARRAY(extended)->len > 0) {
VALUE m = rb_ary_pop(extended);
if (! NIL_P(extmod)) {
while (RARRAY(extmod)->len > 0) {
VALUE m = rb_ary_pop(extmod);
rb_extend_object(v, m);
}
}
@ -1258,7 +1258,7 @@ r_object0(arg, proc, ivp, extended)
"class %s needs to have instance method `_load_data'",
rb_class2name(klass));
}
rb_funcall(v, s_load_data, 1, r_object0(arg, 0, 0, extended));
rb_funcall(v, s_load_data, 1, r_object0(arg, 0, 0, extmod));
}
break;