From: Jan Ziak <0xe2.0x9a.0x9b@gmail.com> Date: Wed, 20 Mar 2013 19:36:33 +0000 (+0100) Subject: runtime: prevent garbage collection during hashmap insertion (fix 2) X-Git-Tag: go1.1rc2~426 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=2001f0c28ef4f2b7b907d060901a6fad2f1e9eb0;p=gostls13.git runtime: prevent garbage collection during hashmap insertion (fix 2) Fixes #5074 in multi-threaded scenarios. R=golang-dev, daniel.morsing, dave, dvyukov, bradfitz, rsc CC=golang-dev, remyoudompheng https://golang.org/cl/7916043 --- diff --git a/src/pkg/runtime/malloc.goc b/src/pkg/runtime/malloc.goc index aae3d233fc..fa28e2b738 100644 --- a/src/pkg/runtime/malloc.goc +++ b/src/pkg/runtime/malloc.goc @@ -35,7 +35,7 @@ runtime·mallocgc(uintptr size, uint32 flag, int32 dogc, int32 zeroed) MSpan *s; void *v; - if(runtime·gcwaiting && g != m->g0 && m->locks == 0) + if(runtime·gcwaiting && g != m->g0 && m->locks == 0 && dogc) runtime·gosched(); if(m->mallocing) runtime·throw("malloc/free - deadlock");