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 | 2db08122e36c137a36ab9768ffceae332c1695f1 (patch) | |
| tree | 95bbb1afaaaabb0ad3401feb03cc930f8f9bd2d8 /src/pkg/runtime/malloc.cgo | |
| parent | 0ba4fada5796425dc0afa524f2537f4f6263e8da (diff) | |
| download | golang-2db08122e36c137a36ab9768ffceae332c1695f1.tar.gz | |
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
http://codereview.appspot.com/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 e34393a85..948257973 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; |
