diff options
| author | Russ Cox <rsc@golang.org> | 2010-01-09 09:47:45 -0800 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2010-01-09 09:47:45 -0800 |
| commit | 5328df6534b9fa2ca83cbbac013ef1e094e11907 (patch) | |
| tree | 0a6fa7c1c69e10eb519d896d2634b6662999e835 /src/pkg/runtime/malloc.cgo | |
| parent | 752b1702d03fbc4377fe856a378c7fa4abbb006f (diff) | |
| download | go-5328df6534b9fa2ca83cbbac013ef1e094e11907.tar.xz | |
runtime: check for preemption due to garbage collection
in various already expensive routines.
helps keep cpu utilization up when GOMAXPROCS > 1,
but not a full solution.
http://groups.google.com/group/golang-nuts/t/7a9535c4136d3e2
R=r
CC=golang-dev
https://golang.org/cl/184043
Diffstat (limited to 'src/pkg/runtime/malloc.cgo')
| -rw-r--r-- | src/pkg/runtime/malloc.cgo | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/pkg/runtime/malloc.cgo b/src/pkg/runtime/malloc.cgo index e34393a85b..948257973e 100644 --- a/src/pkg/runtime/malloc.cgo +++ b/src/pkg/runtime/malloc.cgo @@ -27,10 +27,11 @@ mallocgc(uintptr size, uint32 refflag, int32 dogc) void *v; uint32 *ref; + if(gcwaiting && g != m->g0) + gosched(); if(m->mallocing) throw("malloc/free - deadlock"); m->mallocing = 1; - if(size == 0) size = 1; |
