From: Russ Cox Date: Thu, 30 Sep 2010 18:09:19 +0000 (-0400) Subject: runtime: serialize mcache allocation X-Git-Tag: weekly.2010-10-13~85 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=7389ab8d218fe7b7cf2ebdd232524a1ebd5a0b81;p=gostls13.git runtime: serialize mcache allocation Fixes racy regex-dna-parallel crashes. R=r, r2 CC=golang-dev https://golang.org/cl/2308042 --- diff --git a/src/pkg/runtime/malloc.goc b/src/pkg/runtime/malloc.goc index fa7164ec57..604290b93b 100644 --- a/src/pkg/runtime/malloc.goc +++ b/src/pkg/runtime/malloc.goc @@ -236,9 +236,11 @@ allocmcache(void) { MCache *c; + lock(&mheap); c = FixAlloc_Alloc(&mheap.cachealloc); mstats.mcache_inuse = mheap.cachealloc.inuse; mstats.mcache_sys = mheap.cachealloc.sys; + unlock(&mheap); return c; }