go: cmd/compile: Go 1.9 oom killed on compilation

What version of Go are you using (go version)?

1.9

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

GOARCH=“amd64” GOBIN=“” GOEXE=“” GOHOSTARCH=“amd64” GOHOSTOS=“linux” GOOS=“linux” GOPATH=“/home/user” GORACE=“” GOROOT=“/home/user/go” GOTOOLDIR=“/home/user/go/pkg/tool/linux_amd64” GCCGO=“gccgo” CC=“gcc” GOGCCFLAGS=“-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build501174937=/tmp/go-build -gno-record-gcc-switches” CXX=“g++” CGO_ENABLED=“1” CGO_CFLAGS=“-g -O2” CGO_CPPFLAGS=“” CGO_CXXFLAGS=“-g -O2” CGO_FFLAGS=“-g -O2” CGO_LDFLAGS=“-g -O2” PKG_CONFIG=“pkg-config”

What did you do?

I compiled a very large code base (over 2000) of generated files, essentially composed of structure definition.

What did you expect to see?

Not to crash.

What did you see instead?

All my RAM filled, then my swap and finally the compilation got killed.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 29 (17 by maintainers)

Most upvoted comments

@mdempsky I’ll take a look at that.

In any case, the question of what to do about 1.9 still stands.

This Go program generates a Go source file that demonstrates the issue:

package main

import "fmt"

func main() {
        fmt.Printf("package p\n")
        for _, v := range []string{"a", "b"} {
                fmt.Printf("var %s = map[string]*int{\n", v)
                for i := 0; i < 12000; i++ {
                        fmt.Printf("\t\"%v\": nil,\n", i)
                }
                fmt.Printf("}\n")
        }
}