ruby-changes:29404
From: ko1 <ko1@a...>
Date: Thu, 20 Jun 2013 06:21:27 +0900 (JST)
Subject: [ruby-changes:29404] ko1:r41456 (trunk): * gc.c (gc_profile_total_time): check objspace->profile.next_index > 0.
ko1 2013-06-20 06:21:16 +0900 (Thu, 20 Jun 2013) New Revision: 41456 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41456 Log: * gc.c (gc_profile_total_time): check objspace->profile.next_index > 0. Modified files: trunk/ChangeLog trunk/gc.c Index: ChangeLog =================================================================== --- ChangeLog (revision 41455) +++ ChangeLog (revision 41456) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Jun 20 06:18:01 2013 Koichi Sasada <ko1@a...> + + * gc.c (gc_profile_total_time): check objspace->profile.next_index > 0. + Thu Jun 20 05:47:41 2013 Koichi Sasada <ko1@a...> * gc.c (gc_prof_sweep_timer_start): fix merge miss. Index: gc.c =================================================================== --- gc.c (revision 41455) +++ gc.c (revision 41456) @@ -5348,10 +5348,11 @@ gc_profile_total_time(VALUE self) https://github.com/ruby/ruby/blob/trunk/gc.c#L5348 { double time = 0; rb_objspace_t *objspace = &rb_objspace; - size_t i; - size_t count = objspace->profile.next_index - 1; - if (objspace->profile.run && count > 0) { + if (objspace->profile.run && objspace->profile.next_index > 0) { + size_t i; + size_t count = objspace->profile.next_index - 1; + for (i = 0; i < count; i++) { time += objspace->profile.record[i].gc_time; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/