diff --git a/src/runtime/hashmap.go b/src/runtime/hashmap.go index aaaef483811acf5ae7a6e022d38a9470af63248e..9ca33992bb4dc2d7d4df07a000ee229e66e95685 100644 --- a/src/runtime/hashmap.go +++ b/src/runtime/hashmap.go @@ -96,9 +96,6 @@ const ( // sentinel bucket ID for iterator checks noCheck = 1<<(8*ptrSize) - 1 - - // trigger a garbage collection at every alloc called from this code - checkgc = false ) // A header for a Go map. @@ -246,16 +243,10 @@ func makemap(t *maptype, hint int64, h *hmap, bucket unsafe.Pointer) *hmap { // If hint is large zeroing this memory could take a while. buckets := bucket if B != 0 { - if checkgc { - memstats.next_gc = memstats.heap_alloc - } buckets = newarray(t.bucket, uintptr(1)<<B) } // initialize Hmap - if checkgc { - memstats.next_gc = memstats.heap_alloc - } if h == nil { h = (*hmap)(newobject(t.hmap)) } @@ -430,9 +421,6 @@ func mapassign1(t *maptype, h *hmap, key unsafe.Pointer, val unsafe.Pointer) { hash := alg.hash(key, uintptr(h.hash0)) if h.buckets == nil { - if checkgc { - memstats.next_gc = memstats.heap_alloc - } h.buckets = newarray(t.bucket, 1) } @@ -493,9 +481,6 @@ again: if inserti == nil { // all current buckets are full, allocate a new one. - if checkgc { - memstats.next_gc = memstats.heap_alloc - } newb := (*bmap)(newobject(t.bucket)) h.setoverflow(t, b, newb) inserti = &newb.tophash[0] @@ -505,17 +490,11 @@ again: // store new key/value at insert position if t.indirectkey { - if checkgc { - memstats.next_gc = memstats.heap_alloc - } kmem := newobject(t.key) *(*unsafe.Pointer)(insertk) = kmem insertk = kmem } if t.indirectvalue { - if checkgc { - memstats.next_gc = memstats.heap_alloc - } vmem := newobject(t.elem) *(*unsafe.Pointer)(insertv) = vmem insertv = vmem @@ -776,9 +755,6 @@ func hashGrow(t *maptype, h *hmap) { throw("evacuation not done in time") } oldbuckets := h.buckets - if checkgc { - memstats.next_gc = memstats.heap_alloc - } newbuckets := newarray(t.bucket, uintptr(1)<<(h.B+1)) flags := h.flags &^ (iterator | oldIterator) if h.flags&iterator != 0 { @@ -879,9 +855,6 @@ func evacuate(t *maptype, h *hmap, oldbucket uintptr) { if (hash & newbit) == 0 { b.tophash[i] = evacuatedX if xi == bucketCnt { - if checkgc { - memstats.next_gc = memstats.heap_alloc - } newx := (*bmap)(newobject(t.bucket)) h.setoverflow(t, x, newx) x = newx @@ -906,9 +879,6 @@ func evacuate(t *maptype, h *hmap, oldbucket uintptr) { } else { b.tophash[i] = evacuatedY if yi == bucketCnt { - if checkgc { - memstats.next_gc = memstats.heap_alloc - } newy := (*bmap)(newobject(t.bucket)) h.setoverflow(t, y, newy) y = newy