Skip to content

Commit bb9b20a

Browse files
committed
cmd/api: run half as many go list calls in parallel
We currently run one 'go list' invocation per GOMAXPROC. Since the go command uses memory and has its own internal parallelism, that's unlikely to be an efficient use of resources. Run half as many. I suspect that's still too many but this should fix our OOMs. For #49957. Change-Id: Id06b6e0f0d96387a2a050e400f38bde6ba71aa60 Reviewed-on: https://go-review.googlesource.com/c/go/+/370376 Trust: Heschi Kreinick <[email protected]> Run-TryBot: Heschi Kreinick <[email protected]> Reviewed-by: Bryan Mills <[email protected]>
1 parent 9e29dd4 commit bb9b20a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/cmd/api/goapi.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ type listImports struct {
460460
var listCache sync.Map // map[string]listImports, keyed by contextName
461461

462462
// listSem is a semaphore restricting concurrent invocations of 'go list'.
463-
var listSem = make(chan semToken, runtime.GOMAXPROCS(0))
463+
var listSem = make(chan semToken, ((runtime.GOMAXPROCS(0)-1)/2)+1)
464464

465465
type semToken struct{}
466466

0 commit comments

Comments
 (0)