aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/malloc.goc
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-09-30 14:09:19 -0400
committerRuss Cox <rsc@golang.org>2010-09-30 14:09:19 -0400
commit7389ab8d218fe7b7cf2ebdd232524a1ebd5a0b81 (patch)
treece4c2a0e614c104159278ff068f691b88a96ebab /src/pkg/runtime/malloc.goc
parentf6a217827a4461ece9c81696c40605c7fbb1b267 (diff)
downloadgo-7389ab8d218fe7b7cf2ebdd232524a1ebd5a0b81.tar.xz
runtime: serialize mcache allocation
Fixes racy regex-dna-parallel crashes. R=r, r2 CC=golang-dev https://golang.org/cl/2308042
Diffstat (limited to 'src/pkg/runtime/malloc.goc')
-rw-r--r--src/pkg/runtime/malloc.goc2
1 files changed, 2 insertions, 0 deletions
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;
}