Skip to content

cmd/compile: go build takes too long and creates huge executable with big static array #24724

Closed

Description

@mariecurried

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

go version go1.10.1 windows/amd64

Does this issue reproduce with the latest release?

Yes.

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

set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GORACE=
set GOROOT=C:\Go
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=...

What did you do and what happened?

I'm learning Go and I decided to make a few little programs to get comfortable with the language. Usually the executables are ~1MB. But when I tried to compile the following program, the compilation took a long time and the executable was ~800MB.
https://play.golang.org/p/EK8zDu5vVQN

What did you expect to see?

I expected the executable to be ~1MB, because I tried a similar program, but without the explicit initialization of the first element of the array to 1, and it worked fine. Like the other times, the executable was ~1MB.
https://play.golang.org/p/LM9TBaQcRIo

Activity

  1. ALTree commented on Apr 6, 2018

    @ALTree
    Member

    Thanks for the report.

    This is a duplicate of issue #17378 (cmd/compile: large arrays cause large binaries and toolchain errors); so I'm closing this thread in favour of the old one.

  2. changed the title [-]'go build' takes too long and creates huge executable[/-] [+]cmd/compile: go build takes too long and creates huge executable with big static array[/+] on Apr 6, 2018
  3. locked and limited conversation to collaborators on Apr 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions