]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: prevent garbage collection during hashmap insertion (fix 2)
authorJan Ziak <0xe2.0x9a.0x9b@gmail.com>
Wed, 20 Mar 2013 19:36:33 +0000 (20:36 +0100)
committerJan Ziak <0xe2.0x9a.0x9b@gmail.com>
Wed, 20 Mar 2013 19:36:33 +0000 (20:36 +0100)
Fixes #5074 in multi-threaded scenarios.

R=golang-dev, daniel.morsing, dave, dvyukov, bradfitz, rsc
CC=golang-dev, remyoudompheng
https://golang.org/cl/7916043

src/pkg/runtime/malloc.goc

index aae3d233fccd288d5e4c121fdafb7d5384f92560..fa28e2b738c09a6c76acff08659b6cb1a9d0f1f3 100644 (file)
@@ -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");