зеркало из https://github.com/github/ruby.git
* gc.c (gc_before_sweep): Change algorithm of malloc_limit to
conservative for closing to memory consumption of ruby 2.0. * gc.c (GC_MALLOC_LIMIT, GC_MALLOC_LIMIT_GROWTH_FACTOR): Adjust parameters for new algorithm. Example: make gcbench-rdoc on a pc time maxrss 2.0.0p343 285.27 281853952 trunk before patch 207.19 690405376 trunk after patch 211.59 312500224 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
564a14e497
Коммит
01a7e7893b
|
@ -1,3 +1,11 @@
|
|||
Wed Nov 6 21:30:55 2013 Masaya Tarui <tarui@ruby-lang.org>
|
||||
|
||||
* gc.c (gc_before_sweep): Change algorithm of malloc_limit to
|
||||
conservative for closing to memory consumption of ruby 2.0.
|
||||
|
||||
* gc.c (GC_MALLOC_LIMIT, GC_MALLOC_LIMIT_GROWTH_FACTOR):
|
||||
Adjust parameters for new algorithm.
|
||||
|
||||
Wed Nov 6 21:16:51 2013 Masaki Matsushita <glass.saga@gmail.com>
|
||||
|
||||
* array.c (rb_ary_shift_m): use RARRAY_PTR_USE() without WB because
|
||||
|
|
14
gc.c
14
gc.c
|
@ -91,23 +91,23 @@ rb_gc_guarded_ptr(volatile VALUE *ptr)
|
|||
#endif
|
||||
|
||||
#ifndef GC_MALLOC_LIMIT
|
||||
#define GC_MALLOC_LIMIT (16 /* 16 MB */ * 1024 * 1024 /* 1MB */)
|
||||
#define GC_MALLOC_LIMIT (8 * 1024 * 1024 /* 8MB */)
|
||||
#endif
|
||||
#ifndef GC_MALLOC_LIMIT_MAX
|
||||
#define GC_MALLOC_LIMIT_MAX (384 /* 384 MB */ * 1024 * 1024 /* 1MB */)
|
||||
#define GC_MALLOC_LIMIT_MAX (384 * 1024 * 1024 /* 384MB */)
|
||||
#endif
|
||||
#ifndef GC_MALLOC_LIMIT_GROWTH_FACTOR
|
||||
#define GC_MALLOC_LIMIT_GROWTH_FACTOR 2.0
|
||||
#define GC_MALLOC_LIMIT_GROWTH_FACTOR 1.0
|
||||
#endif
|
||||
|
||||
#ifndef GC_HEAP_OLDSPACE_MIN
|
||||
#define GC_HEAP_OLDSPACE_MIN (16 /* 16 MB */ * 1024 * 1024 /* 1MB */)
|
||||
#define GC_HEAP_OLDSPACE_MIN (16 * 1024 * 1024 /* 16MB */)
|
||||
#endif
|
||||
#ifndef GC_HEAP_OLDSPACE_GROWTH_FACTOR
|
||||
#define GC_HEAP_OLDSPACE_GROWTH_FACTOR 1.8
|
||||
#endif
|
||||
#ifndef GC_HEAP_OLDSPACE_MAX
|
||||
#define GC_HEAP_OLDSPACE_MAX (384 /* 384 MB */ * 1024 * 1024 /* 1MB */)
|
||||
#define GC_HEAP_OLDSPACE_MAX (384 * 1024 * 1024 /* 384MB */)
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
|
@ -2812,14 +2812,14 @@ gc_before_sweep(rb_objspace_t *objspace)
|
|||
size_t old_limit = malloc_limit;
|
||||
|
||||
if (inc > malloc_limit) {
|
||||
malloc_limit += (size_t)(malloc_limit * (initial_malloc_limit_growth_factor - 1));
|
||||
malloc_limit = (size_t)(inc * initial_malloc_limit_growth_factor);
|
||||
if (initial_malloc_limit_max > 0 && /* ignore max-check if 0 */
|
||||
malloc_limit > initial_malloc_limit_max) {
|
||||
malloc_limit = initial_malloc_limit_max;
|
||||
}
|
||||
}
|
||||
else {
|
||||
malloc_limit -= (size_t)(malloc_limit * ((initial_malloc_limit_growth_factor - 1) / 10));
|
||||
malloc_limit = (size_t)(malloc_limit * 0.98); /* magic number */
|
||||
if (malloc_limit < initial_malloc_limit) {
|
||||
malloc_limit = initial_malloc_limit;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче