mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
* gc.c: modify malloc_limit strategy.
* fix default vaues: GC_MALLOC_LIMIT_GROWTH_FACTOR GC_MALLOC_LIMIT: 8MB -> 16MB GC_MALLOC_LIMIT_MAX: 384MB -> 32MB * algorithm of malloc_limit increment. if (malloc_increase < malloc_limit) { next_malloc_limit = malloc_limit * factor if (malloc_limit > malloc_limit_max) { malloc_limit = malloc_increase } } This algorithm change malloc_limit from 16MB -> 32MB slowly. If malloc_limit exceeds malloc_limit_max, then increase with malloc_increase. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2d5233c0f5
commit
a6698bc676
2 changed files with 27 additions and 4 deletions
21
ChangeLog
21
ChangeLog
|
@ -1,3 +1,24 @@
|
|||
Thu Nov 7 19:36:09 2013 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* gc.c: modify malloc_limit strategy.
|
||||
|
||||
* fix default vaues:
|
||||
GC_MALLOC_LIMIT_GROWTH_FACTOR
|
||||
GC_MALLOC_LIMIT: 8MB -> 16MB
|
||||
GC_MALLOC_LIMIT_MAX: 384MB -> 32MB
|
||||
|
||||
* algorithm of malloc_limit increment.
|
||||
if (malloc_increase < malloc_limit) {
|
||||
next_malloc_limit = malloc_limit * factor
|
||||
if (malloc_limit > malloc_limit_max) {
|
||||
malloc_limit = malloc_increase
|
||||
}
|
||||
}
|
||||
This algorithm change malloc_limit from
|
||||
16MB -> 32MB slowly.
|
||||
If malloc_limit exceeds malloc_limit_max, then
|
||||
increase with malloc_increase.
|
||||
|
||||
Thu Nov 7 11:06:05 2013 Masaki Matsushita <glass.saga@gmail.com>
|
||||
|
||||
* array.c (rb_ary_shuffle_bang): use RARRAY_PTR_USE() without WB
|
||||
|
|
10
gc.c
10
gc.c
|
@ -91,13 +91,13 @@ rb_gc_guarded_ptr(volatile VALUE *ptr)
|
|||
#endif
|
||||
|
||||
#ifndef GC_MALLOC_LIMIT
|
||||
#define GC_MALLOC_LIMIT (8 * 1024 * 1024 /* 8MB */)
|
||||
#define GC_MALLOC_LIMIT (16 * 1024 * 1024 /* 16MB */)
|
||||
#endif
|
||||
#ifndef GC_MALLOC_LIMIT_MAX
|
||||
#define GC_MALLOC_LIMIT_MAX (384 * 1024 * 1024 /* 384MB */)
|
||||
#define GC_MALLOC_LIMIT_MAX (32 * 1024 * 1024 /* 32MB */)
|
||||
#endif
|
||||
#ifndef GC_MALLOC_LIMIT_GROWTH_FACTOR
|
||||
#define GC_MALLOC_LIMIT_GROWTH_FACTOR 1.0
|
||||
#define GC_MALLOC_LIMIT_GROWTH_FACTOR 1.4
|
||||
#endif
|
||||
|
||||
#ifndef GC_HEAP_OLDSPACE_MIN
|
||||
|
@ -2807,6 +2807,8 @@ gc_before_sweep(rb_objspace_t *objspace)
|
|||
gc_prof_set_malloc_info(objspace);
|
||||
|
||||
/* reset malloc info */
|
||||
if (0) fprintf(stderr, "%d\t%d\t%d\n", (int)rb_gc_count(), (int)malloc_increase, (int)malloc_limit);
|
||||
|
||||
{
|
||||
size_t inc = ATOMIC_SIZE_EXCHANGE(malloc_increase, 0);
|
||||
size_t old_limit = malloc_limit;
|
||||
|
@ -2815,7 +2817,7 @@ gc_before_sweep(rb_objspace_t *objspace)
|
|||
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;
|
||||
malloc_limit = inc;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue