Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: increased VmSize/VmData consumption #44999

Closed
AlexBlack772 opened this issue Mar 14, 2021 · 5 comments
Closed

runtime: increased VmSize/VmData consumption #44999

AlexBlack772 opened this issue Mar 14, 2021 · 5 comments

Comments

@AlexBlack772
Copy link

AlexBlack772 commented Mar 14, 2021

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

go version go1.16.2 linux/amd64
CentOS Linux release 7.7.1908 (Core)
kernel-3.10.0-1062.el7.x86_64

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
O111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/root/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/root/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/go/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/go/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16.2"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/opt/go/go/go.mod"
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-build1972922996=/tmp/go-build -gno-record-gcc-switches"

What did you do?

A programm allocates some memory and than release it.

https://play.golang.org/p/Ljr0c6zRasB

What did you expect to see?

After golang version update to 1.16.2 I expect to see the same memory consumption as with go lang 1.13

With go lang 1.13 programm output was:

START VmSize:138Mb VmLck:0 VmPin:0 VmRSS:1 VmData:131 VmStk:0 VmExe:0 VmLib:1
VmSize:476Mb VmLck:0 VmPin:0 VmRSS:11 VmData:468 VmStk:0 VmExe:0 VmLib:1
VmSize:476Mb VmLck:0 VmPin:0 VmRSS:12 VmData:468 VmStk:0 VmExe:0 VmLib:1

What did you see instead?

With go lang 1.16.2 programm output is:

START VmSize:725Mb VmLck:0 VmPin:0 VmRSS:1 VmData:717 VmStk:0 VmExe:0 VmLib:1
VmSize:1321Mb VmLck:0 VmPin:0 VmRSS:21 VmData:1313 VmStk:0 VmExe:0 VmLib:1
VmSize:1321Mb VmLck:0 VmPin:0 VmRSS:22 VmData:1313 VmStk:0 VmExe:0 VmLib:1

Memory consumption is three times more in comparison with go lang 1.13 (VmSize:476Mb vs VmSize:1321Mb)

@AlexBlack772 AlexBlack772 changed the title GoLang update from 1.13->1.16 cause more VmData consumption GoLang update from 1.13->1.16 causes more VmData consumption Mar 14, 2021
@AlexBlack772 AlexBlack772 changed the title GoLang update from 1.13->1.16 causes more VmData consumption GoLang update from 1.13->1.16 causes more VmSize/VmData consumption Mar 14, 2021
@mdlayher mdlayher changed the title GoLang update from 1.13->1.16 causes more VmSize/VmData consumption runtime: increased VmSize/VmData consumption Mar 14, 2021
@AlexRouSg
Copy link
Contributor

This sounds like #44554

@davecheney
Copy link
Contributor

Duplicate of #44554

@davecheney davecheney marked this as a duplicate of #44554 Mar 15, 2021
@davecheney
Copy link
Contributor

reopening at the OP's request

@davecheney davecheney reopened this Mar 18, 2021
@AlexBlack772
Copy link
Author

AlexBlack772 commented Mar 18, 2021

Issue #44554 talks about memory consumption increase in release 1.16 in comparison with release 1.15

My issue was about memory increase in 1.15, 1,16 releases in comparison with 1.13

I dig a bit more, here what I've found

For the sake of simplicity I used a test programm below


package main

import (
   "fmt"
   "io/ioutil"
)

func main() {
    contents, err := ioutil.ReadFile("/proc/self/status")
    if err != nil {
       fmt.Println("Error")
        return
     }

     fmt.Println(string(contents))
}

With release go1.13.15.linux-amd64.tar.gz (from page https://golang.org/dl/)

results are following

[root@localhost versions]# /mnt/ext-drive/go-ver/go1.13.15/bin/go run ./test.go
....

VmPeak: 102816 kB
VmSize: 102816 kB
.....

With release go1.14.linux-amd64.tar.gz memory usage increased 7 times

[root@localhost versions]# /mnt/ext-drive/go-ver/go1.14.0/bin/go run ./test.go

.....
VmPeak: 703080 kB
VmSize: 703080 kB
.....

[root@localhost versions]# cat /etc/centos-release
CentOS Linux release 7.7.1908 (Core)

@cherrymui
Copy link
Member

As explained in #45000 (comment) , VmSize/VsData does not reflect actual physical memory resources used, and this is working as intended. Closing. Thanks.

cc @mknyszek in case I'm mistaken.

@golang golang locked and limited conversation to collaborators Mar 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants