Skip to content

time: time.FixedZone used most of memory when trasfer json marshaled time data among servers in different time zone #42574

@locallocal

Description

@locallocal

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

$ go version
go version go1.15.3 linux/amd64

Does this issue reproduce with the latest release?

yes

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

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/test/.cache/go-build"
GOENV="/home/test/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/test/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/test/go"
GOPRIVATE=""
GOPROXY="https://goproxy.io,direct"
GOROOT="/usr/lib/golang"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build986830040=/tmp/go-build -gno-record-gcc-switches"

What did you do?

transfer struct data with json marshal betwen server and client, which includes three time fileds,
The special place is the server and cliet have differnt time zone.

What did you expect to see?

What did you see instead?

time.FixedZone uses most of the memory.

(pprof) top10
Showing nodes accounting for 10211.07MB, 99.46% of 10266.25MB total
Dropped 42 nodes (cum <= 51.33MB)
Showing top 10 nodes out of 33
flat flat% sum% cum cum%
4563.38MB 44.45% 44.45% 4563.38MB 44.45% time.FixedZone (inline)

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