You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version)?
go version go1.6 darwin/amd64
What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH=""
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GO15VENDOREXPERIMENT="1"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"
What did you do?
I am writing a program using golang to run in background process in ios,and the ios only give me 5MB memory to run golang code.I reduce almost all memory allocations in my code part,but the golang runtime code part contains a lot memory allocations.
I found init data in /usr/local/go/src/unicode/tables.go:6944 uses runtime.mallocgc to alloc some heap memory.
But following code do not alloc heap memory, it put those data into a writable init data field in the executable file,and the data is loaded into memory once by os.I think put the data into writable init data part and do not use them can reduce the memory size pressure in the ios background process(It looks like only count the memory page the has been read once and I do not use unicode),I think skip the runtime.mallocgc process can reduce init time of the program,reduce the pressure of the gc part.(the gc can skip them).
var uncompressDataS = `abcde
// 500KB of binary data.
asdfad
`
What did you expect to see?
Init data in /usr/local/go/src/unicode/tables.go:6944 should not use runtime.mallocgc to alloc heap memory. It can put into a writable/readonly init data field in the executable file.
What did you see instead?
Init data in /usr/local/go/src/unicode/tables.go:6944 uses runtime.mallocgc to alloc some heap memory.
Those heap allocation can be found by GODEBUG=allocfreetrace=1
The text was updated successfully, but these errors were encountered:
Those mallocs you see are only for allocating maps. All the slices require no allocations. So this is a duplicate of #2559. I don't see any way to easily fix this, as statically allocated maps would have to be different somehow (at least in their hash function).
One thing I noticed is that growings are happening during the initialization. I've opened a separate bug #15880 for that. It should eliminate a good chunk of the startup allocations you're seeing.
Please answer these questions before submitting your issue. Thanks!
go version
)?go version go1.6 darwin/amd64
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH=""
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GO15VENDOREXPERIMENT="1"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"
I am writing a program using golang to run in background process in ios,and the ios only give me 5MB memory to run golang code.I reduce almost all memory allocations in my code part,but the golang runtime code part contains a lot memory allocations.
I found init data in /usr/local/go/src/unicode/tables.go:6944 uses runtime.mallocgc to alloc some heap memory.
But following code do not alloc heap memory, it put those data into a writable init data field in the executable file,and the data is loaded into memory once by os.I think put the data into writable init data part and do not use them can reduce the memory size pressure in the ios background process(It looks like only count the memory page the has been read once and I do not use unicode),I think skip the runtime.mallocgc process can reduce init time of the program,reduce the pressure of the gc part.(the gc can skip them).
Init data in /usr/local/go/src/unicode/tables.go:6944 should not use runtime.mallocgc to alloc heap memory. It can put into a writable/readonly init data field in the executable file.
Init data in /usr/local/go/src/unicode/tables.go:6944 uses runtime.mallocgc to alloc some heap memory.
Those heap allocation can be found by GODEBUG=allocfreetrace=1
The text was updated successfully, but these errors were encountered: