{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/28114","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/28114/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/28114/comments","events_url":"https://api.github.com/repos/golang/go/issues/28114/events","html_url":"https://github.com/golang/go/issues/28114","id":368507567,"node_id":"MDU6SXNzdWUzNjg1MDc1Njc=","number":28114,"title":"runtime: programs compiled by 1.11 allocate an unreasonable amount of virtual memory","user":{"login":"HouzuoGuo","id":563872,"node_id":"MDQ6VXNlcjU2Mzg3Mg==","avatar_url":"https://avatars1.githubusercontent.com/u/563872?v=4","gravatar_id":"","url":"https://api.github.com/users/HouzuoGuo","html_url":"https://github.com/HouzuoGuo","followers_url":"https://api.github.com/users/HouzuoGuo/followers","following_url":"https://api.github.com/users/HouzuoGuo/following{/other_user}","gists_url":"https://api.github.com/users/HouzuoGuo/gists{/gist_id}","starred_url":"https://api.github.com/users/HouzuoGuo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HouzuoGuo/subscriptions","organizations_url":"https://api.github.com/users/HouzuoGuo/orgs","repos_url":"https://api.github.com/users/HouzuoGuo/repos","events_url":"https://api.github.com/users/HouzuoGuo/events{/privacy}","received_events_url":"https://api.github.com/users/HouzuoGuo/received_events","type":"User","site_admin":false},"labels":[{"id":373402289,"node_id":"MDU6TGFiZWwzNzM0MDIyODk=","url":"https://api.github.com/repos/golang/go/labels/NeedsInvestigation","name":"NeedsInvestigation","color":"ededed","default":false},{"id":626114820,"node_id":"MDU6TGFiZWw2MjYxMTQ4MjA=","url":"https://api.github.com/repos/golang/go/labels/release-blocker","name":"release-blocker","color":"b60205","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/golang/go/milestones/65","html_url":"https://github.com/golang/go/milestone/65","labels_url":"https://api.github.com/repos/golang/go/milestones/65/labels","id":3072996,"node_id":"MDk6TWlsZXN0b25lMzA3Mjk5Ng==","number":65,"title":"Go1.12","description":"","creator":{"login":"rsc","id":104030,"node_id":"MDQ6VXNlcjEwNDAzMA==","avatar_url":"https://avatars1.githubusercontent.com/u/104030?v=4","gravatar_id":"","url":"https://api.github.com/users/rsc","html_url":"https://github.com/rsc","followers_url":"https://api.github.com/users/rsc/followers","following_url":"https://api.github.com/users/rsc/following{/other_user}","gists_url":"https://api.github.com/users/rsc/gists{/gist_id}","starred_url":"https://api.github.com/users/rsc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsc/subscriptions","organizations_url":"https://api.github.com/users/rsc/orgs","repos_url":"https://api.github.com/users/rsc/repos","events_url":"https://api.github.com/users/rsc/events{/privacy}","received_events_url":"https://api.github.com/users/rsc/received_events","type":"User","site_admin":false},"open_issues":766,"closed_issues":268,"state":"open","created_at":"2018-01-29T21:17:52Z","updated_at":"2018-10-12T05:48:07Z","due_on":"2019-01-31T08:00:00Z","closed_at":null},"comments":8,"created_at":"2018-10-10T06:07:37Z","updated_at":"2018-10-12T05:53:24Z","closed_at":null,"author_association":"NONE","body":"### What version of Go are you using (`go version`)?\r\ngo1.11.1 linux/amd6\r\n\r\n### Does this issue reproduce with the latest release?\r\nIt was first discovered under go 1.11, and the issue remains in the minor upgrade to 1.11.1.\r\n\r\n### What operating system and processor architecture are you using (`go env`)?\r\n```\r\nGOARCH=\"amd64\"\r\nGOBIN=\"\"\r\nGOCACHE=\"/home/howard/.cache/go-build\"\r\nGOEXE=\"\"\r\nGOFLAGS=\"\"\r\nGOHOSTARCH=\"amd64\"\r\nGOHOSTOS=\"linux\"\r\nGOOS=\"linux\"\r\nGOPATH=\"/home/howard/gopath\"\r\nGOPROXY=\"\"\r\nGORACE=\"\"\r\nGOROOT=\"/home/howard/go\"\r\nGOTMPDIR=\"\"\r\nGOTOOLDIR=\"/home/howard/go/pkg/tool/linux_amd64\"\r\nGCCGO=\"gccgo\"\r\nCC=\"gcc\"\r\nCXX=\"g++\"\r\nCGO_ENABLED=\"1\"\r\nGOMOD=\"\"\r\nCGO_CFLAGS=\"-g -O2\"\r\nCGO_CPPFLAGS=\"\"\r\nCGO_CXXFLAGS=\"-g -O2\"\r\nCGO_FFLAGS=\"-g -O2\"\r\nCGO_LDFLAGS=\"-g -O2\"\r\nPKG_CONFIG=\"pkg-config\"\r\nGOGCCFLAGS=\"-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build718493987=/tmp/go-build -gno-record-gcc-switches\"\r\n```\r\n\r\n### What did you do?\r\nCompile the following trivial program:\r\n```\r\npackage main\r\n\r\nfunc main() {\r\n        for {\r\n        }\r\n}\r\n```\r\n\r\n`go build -o usagetest; ./usagetest` and observe its memory usage as monitored by host operating system, for example via `ps aux | grep usagetest`.\r\n\r\n### What did you expect to see?\r\nCompiled by 1.10.4, the program uses a very reasonable amount of virtual (2MB) and resident (600KB) memory:\r\n\r\n`howard   10838  101  0.0   2384   688 pts/2    Rl+  05:57   0:59 ./usagetest`\r\n\r\nBut when compiled by 1.11 (or 1.11.1), the virtual memory usage dramatically increases to 102MB:\r\n\r\n`howard   11326 99.5  0.1 101820  4776 pts/2    Rl+  05:59   1:58 ./usagetest`\r\n\r\nThe significant increase in virtual memory usage is usually not an issue, however security sensitive programs often lock their memory, causing a far greater performance degradation on low-spec computer hosts."},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/429212312","html_url":"https://github.com/golang/go/issues/28114#issuecomment-429212312","issue_url":"https://api.github.com/repos/golang/go/issues/28114","id":429212312,"node_id":"MDEyOklzc3VlQ29tbWVudDQyOTIxMjMxMg==","user":{"login":"HouzuoGuo","id":563872,"node_id":"MDQ6VXNlcjU2Mzg3Mg==","avatar_url":"https://avatars1.githubusercontent.com/u/563872?v=4","gravatar_id":"","url":"https://api.github.com/users/HouzuoGuo","html_url":"https://github.com/HouzuoGuo","followers_url":"https://api.github.com/users/HouzuoGuo/followers","following_url":"https://api.github.com/users/HouzuoGuo/following{/other_user}","gists_url":"https://api.github.com/users/HouzuoGuo/gists{/gist_id}","starred_url":"https://api.github.com/users/HouzuoGuo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HouzuoGuo/subscriptions","organizations_url":"https://api.github.com/users/HouzuoGuo/orgs","repos_url":"https://api.github.com/users/HouzuoGuo/repos","events_url":"https://api.github.com/users/HouzuoGuo/events{/privacy}","received_events_url":"https://api.github.com/users/HouzuoGuo/received_events","type":"User","site_admin":false},"created_at":"2018-10-12T05:53:24Z","updated_at":"2018-10-12T05:53:24Z","author_association":"NONE","body":"Thanks @aclements , TIL about MCL_ONFAULT, apparently available since Linux 4.4. I shall use it from now and onward.\r\n\r\nBeyond the scope of this issue report, would you please offer some hints on the proper invocation of mlock in protecting a sensitive instance of structure, especially to determine its memory address range? Take this structure for example\r\n\r\n```\r\ntype Daemon struct {\r\n    ListenAddress string\r\n    ListenPort int\r\n    InternalData map[string]interface{}\r\n}\r\n```"}}
{"actor":{"display_login":"HouzuoGuo"}}