]> Cypherpunks repositories - gostls13.git/commit
runtime: avoid divide-by-zero in GC trigger controller
authorAustin Clements <austin@google.com>
Tue, 21 Apr 2015 17:46:54 +0000 (13:46 -0400)
committerAustin Clements <austin@google.com>
Wed, 22 Apr 2015 19:07:36 +0000 (19:07 +0000)
commit1f39beb01a5ca6a9015d6a30af5a968a247f8d10
treef3c9d1501cef73e3bd62d6f78ce7b01bda745a71
parent7820d270498d6d4d960f7e34a0a80cafe2d05117
runtime: avoid divide-by-zero in GC trigger controller

The trigger controller computes GC CPU utilization by dividing by the
wall-clock time that's passed since concurrent mark began. Since this
delta is nanoseconds it's borderline impossible for it to be zero, but
if it is zero we'll currently divide by zero. Be robust to this
possibility by ignoring the utilization in the error term if no time
has elapsed.

Change-Id: I93dfc9e84735682af3e637f6538d1e7602634f09
Reviewed-on: https://go-review.googlesource.com/9175
Reviewed-by: Rick Hudson <rlh@golang.org>
src/runtime/mgc.go