зеркало из https://github.com/github/ruby.git
* gc.c (ruby_xmalloc): remove MALLOC_LIMIT to avoid frequent
garabage collection. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
3edb155cd1
Коммит
7881363731
|
@ -3,6 +3,11 @@ Fri Sep 6 12:11:22 2002 Minero Aoki <aamine@loveruby.net>
|
|||
* parse.y (rb_gc_mark_parser): should mark ALL global variables
|
||||
defined in parse.y.
|
||||
|
||||
Fri Sep 6 01:15:23 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* gc.c (ruby_xmalloc): remove MALLOC_LIMIT to avoid frequent
|
||||
garabage collection.
|
||||
|
||||
Fri Sep 6 11:47:37 2002 Minero Aoki <aamine@loveruby.net>
|
||||
|
||||
* parse.y (rb_gc_mark_parser): should mark global variables
|
||||
|
|
1
ToDo
1
ToDo
|
@ -106,7 +106,6 @@ Standard Libraries
|
|||
* deprecate Array#indexes, and Array#indices.
|
||||
* require "1.6" etc. by /usr/lib/ruby/1.6/1.6.rb ;-)
|
||||
* save both "feature names" and "normalized path" in $"
|
||||
* allow marshaling of extend'ed object.
|
||||
|
||||
Extension Libraries
|
||||
|
||||
|
|
2
file.c
2
file.c
|
@ -2372,7 +2372,7 @@ path_check_1(path)
|
|||
&& (!p || !(st.st_mode & S_ISVTX))
|
||||
#endif
|
||||
) {
|
||||
rb_warn("Insecure world writable dir %s , mode 0%o", p0, st.st_mode);
|
||||
rb_warn("Insecure world writable dir %s, mode 0%o", p0, st.st_mode);
|
||||
if (p) *p = '/';
|
||||
return 0;
|
||||
}
|
||||
|
|
20
gc.c
20
gc.c
|
@ -53,16 +53,6 @@ void *alloca ();
|
|||
#endif
|
||||
|
||||
static void run_final();
|
||||
|
||||
#ifndef GC_MALLOC_LIMIT
|
||||
#if defined(MSDOS) || defined(__human68k__)
|
||||
#define GC_MALLOC_LIMIT 200000
|
||||
#else
|
||||
#define GC_MALLOC_LIMIT 8000000
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static unsigned long malloc_memories = 0;
|
||||
static VALUE nomem_error;
|
||||
|
||||
void
|
||||
|
@ -88,11 +78,7 @@ ruby_xmalloc(size)
|
|||
rb_raise(rb_eNoMemError, "negative allocation size (or too big)");
|
||||
}
|
||||
if (size == 0) size = 1;
|
||||
malloc_memories += size;
|
||||
|
||||
if (malloc_memories > GC_MALLOC_LIMIT) {
|
||||
rb_gc();
|
||||
}
|
||||
RUBY_CRITICAL(mem = malloc(size));
|
||||
if (!mem) {
|
||||
rb_gc();
|
||||
|
@ -129,7 +115,6 @@ ruby_xrealloc(ptr, size)
|
|||
}
|
||||
if (!ptr) return xmalloc(size);
|
||||
if (size == 0) size = 1;
|
||||
malloc_memories += size;
|
||||
RUBY_CRITICAL(mem = realloc(ptr, size));
|
||||
if (!mem) {
|
||||
rb_gc();
|
||||
|
@ -1131,15 +1116,12 @@ rb_gc()
|
|||
SET_STACK_END;
|
||||
|
||||
if (dont_gc || during_gc) {
|
||||
if (!freelist || malloc_memories > GC_MALLOC_LIMIT) {
|
||||
malloc_memories = 0;
|
||||
if (!freelist) {
|
||||
add_heap();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
malloc_memories = 0;
|
||||
|
||||
if (during_gc) return;
|
||||
during_gc++;
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ w_bytes(s, n, arg)
|
|||
fwrite(s, 1, n, arg->fp);
|
||||
}
|
||||
else {
|
||||
rb_str_cat(arg->str, s, n);
|
||||
rb_str_buf_cat(arg->str, s, n);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1018,8 +1018,11 @@ cvt(value, ndigits, flags, sign, decpt, ch, length)
|
|||
if (value < 0) {
|
||||
value = -value;
|
||||
*sign = '-';
|
||||
} else
|
||||
*sign = '\000';
|
||||
} else if (value == 0.0 && 1.0/value < 0) {
|
||||
*sign = '-';
|
||||
} else {
|
||||
*sign = '\000';
|
||||
}
|
||||
digits = BSD__dtoa(value, mode, ndigits, decpt, &dsgn, &rve);
|
||||
if (flags & ALT) { /* Print trailing zeros */
|
||||
bp = digits + ndigits;
|
||||
|
|
Загрузка…
Ссылка в новой задаче