ruby-changes:29610
From: usa <ko1@a...>
Date: Wed, 26 Jun 2013 23:49:51 +0900 (JST)
Subject: [ruby-changes:29610] usa:r41662 (ruby_1_9_3): revert r41628 because it causes memory error on mswin.
usa 2013-06-26 23:49:37 +0900 (Wed, 26 Jun 2013) New Revision: 41662 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41662 Log: revert r41628 because it causes memory error on mswin. Modified files: branches/ruby_1_9_3/ChangeLog branches/ruby_1_9_3/gc.c branches/ruby_1_9_3/version.h Index: ruby_1_9_3/ChangeLog =================================================================== --- ruby_1_9_3/ChangeLog (revision 41661) +++ ruby_1_9_3/ChangeLog (revision 41662) @@ -92,15 +92,6 @@ Wed Jun 26 16:10:01 2013 Eric Hodel <d https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ChangeLog#L92 * ext/socket/extconf.rb: Enable RFC 3542 IPV6 socket options for OS X 10.7+. [ruby-trunk - Bug #8517] -Tue Jun 25 21:54:17 2013 NAKAMURA Usaku <usa@r...> - - * gc.c: Fixup around GC by MALLOC. - Add allocate size to malloc_increase before GC - for updating limit in after_gc_sweep. - Reset malloc_increase into garbage_collect() - for preventing GC again soon. - this backport patch is written by nari. - Wed Jun 5 12:38:14 2013 Nobuyoshi Nakada <nobu@r...> * win32/win32.c (setup_overlapped, finish_overlapped): extract from Index: ruby_1_9_3/gc.c =================================================================== --- ruby_1_9_3/gc.c (revision 41661) +++ ruby_1_9_3/gc.c (revision 41662) @@ -236,7 +236,7 @@ getrusage_time(void) https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/gc.c#L236 #define GC_PROF_SET_MALLOC_INFO do {\ if (objspace->profile.run) {\ gc_profile_record *record = &objspace->profile.record[objspace->profile.count];\ - record->allocate_increase = malloc_increase + malloc_increase2;\ + record->allocate_increase = malloc_increase;\ record->allocate_limit = malloc_limit; \ }\ } while(0) @@ -352,7 +352,6 @@ typedef struct rb_objspace { https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/gc.c#L352 struct { size_t limit; size_t increase; - size_t increase2; #if CALC_EXACT_MALLOC_SIZE size_t allocated_size; size_t allocations; @@ -406,7 +405,6 @@ int *ruby_initial_gc_stress_ptr = &rb_ob https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/gc.c#L405 #endif #define malloc_limit objspace->malloc_params.limit #define malloc_increase objspace->malloc_params.increase -#define malloc_increase2 objspace->malloc_params.increase2 #define heaps objspace->heap.ptr #define heaps_length objspace->heap.length #define heaps_used objspace->heap.used @@ -758,9 +756,8 @@ vm_malloc_prepare(rb_objspace_t *objspac https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/gc.c#L756 size += sizeof(size_t); #endif - malloc_increase += size; if ((ruby_gc_stress && !ruby_disable_gc_stress) || - malloc_increase > malloc_limit) { + (malloc_increase+size) > malloc_limit) { garbage_collect_with_gvl(objspace); } @@ -770,6 +767,8 @@ vm_malloc_prepare(rb_objspace_t *objspac https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/gc.c#L767 static inline void * vm_malloc_fixup(rb_objspace_t *objspace, void *mem, size_t size) { + malloc_increase += size; + #if CALC_EXACT_MALLOC_SIZE objspace->malloc_params.allocated_size += size; objspace->malloc_params.allocations++; @@ -2212,8 +2211,6 @@ before_gc_sweep(rb_objspace_t *objspace) https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/gc.c#L2211 objspace->heap.sweep_slots = heaps; objspace->heap.free_num = 0; - malloc_increase2 += ATOMIC_SIZE_EXCHANGE(malloc_increase,0); - /* sweep unlinked method entries */ if (GET_VM()->unlinked_method_entry_list) { rb_sweep_method_entry(GET_VM()); @@ -2230,12 +2227,11 @@ after_gc_sweep(rb_objspace_t *objspace) https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/gc.c#L2227 heaps_increment(objspace); } - if ((malloc_increase + malloc_increase2) > malloc_limit) { + if (malloc_increase > malloc_limit) { malloc_limit += (size_t)((malloc_increase - malloc_limit) * (double)objspace->heap.live_num / (heaps_used * HEAP_OBJ_LIMIT)); if (malloc_limit < initial_malloc_limit) malloc_limit = initial_malloc_limit; } malloc_increase = 0; - malloc_increase2 = 0; free_unused_heaps(objspace); } Index: ruby_1_9_3/version.h =================================================================== --- ruby_1_9_3/version.h (revision 41661) +++ ruby_1_9_3/version.h (revision 41662) @@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/version.h#L1 #define RUBY_VERSION "1.9.3" -#define RUBY_PATCHLEVEL 446 +#define RUBY_PATCHLEVEL 447 #define RUBY_RELEASE_DATE "2013-06-26" #define RUBY_RELEASE_YEAR 2013 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/