{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/14045","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/14045/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/14045/comments","events_url":"https://api.github.com/repos/golang/go/issues/14045/events","html_url":"https://github.com/golang/go/issues/14045","id":127794890,"node_id":"MDU6SXNzdWUxMjc3OTQ4OTA=","number":14045,"title":"runtime: reclaim memory used by huge array that is no longer referenced","user":{"login":"ibukanov","id":2381216,"node_id":"MDQ6VXNlcjIzODEyMTY=","avatar_url":"https://avatars3.githubusercontent.com/u/2381216?v=4","gravatar_id":"","url":"https://api.github.com/users/ibukanov","html_url":"https://github.com/ibukanov","followers_url":"https://api.github.com/users/ibukanov/followers","following_url":"https://api.github.com/users/ibukanov/following{/other_user}","gists_url":"https://api.github.com/users/ibukanov/gists{/gist_id}","starred_url":"https://api.github.com/users/ibukanov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ibukanov/subscriptions","organizations_url":"https://api.github.com/users/ibukanov/orgs","repos_url":"https://api.github.com/users/ibukanov/repos","events_url":"https://api.github.com/users/ibukanov/events{/privacy}","received_events_url":"https://api.github.com/users/ibukanov/received_events","type":"User","site_admin":false},"labels":[{"id":373399998,"node_id":"MDU6TGFiZWwzNzMzOTk5OTg=","url":"https://api.github.com/repos/golang/go/labels/NeedsFix","name":"NeedsFix","color":"ededed","default":false}],"state":"open","locked":false,"assignee":{"login":"aclements","id":2688315,"node_id":"MDQ6VXNlcjI2ODgzMTU=","avatar_url":"https://avatars0.githubusercontent.com/u/2688315?v=4","gravatar_id":"","url":"https://api.github.com/users/aclements","html_url":"https://github.com/aclements","followers_url":"https://api.github.com/users/aclements/followers","following_url":"https://api.github.com/users/aclements/following{/other_user}","gists_url":"https://api.github.com/users/aclements/gists{/gist_id}","starred_url":"https://api.github.com/users/aclements/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aclements/subscriptions","organizations_url":"https://api.github.com/users/aclements/orgs","repos_url":"https://api.github.com/users/aclements/repos","events_url":"https://api.github.com/users/aclements/events{/privacy}","received_events_url":"https://api.github.com/users/aclements/received_events","type":"User","site_admin":false},"assignees":[{"login":"aclements","id":2688315,"node_id":"MDQ6VXNlcjI2ODgzMTU=","avatar_url":"https://avatars0.githubusercontent.com/u/2688315?v=4","gravatar_id":"","url":"https://api.github.com/users/aclements","html_url":"https://github.com/aclements","followers_url":"https://api.github.com/users/aclements/followers","following_url":"https://api.github.com/users/aclements/following{/other_user}","gists_url":"https://api.github.com/users/aclements/gists{/gist_id}","starred_url":"https://api.github.com/users/aclements/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aclements/subscriptions","organizations_url":"https://api.github.com/users/aclements/orgs","repos_url":"https://api.github.com/users/aclements/repos","events_url":"https://api.github.com/users/aclements/events{/privacy}","received_events_url":"https://api.github.com/users/aclements/received_events","type":"User","site_admin":false}],"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":756,"closed_issues":254,"state":"open","created_at":"2018-01-29T21:17:52Z","updated_at":"2018-10-08T18:34:12Z","due_on":"2019-01-31T08:00:00Z","closed_at":null},"comments":16,"created_at":"2016-01-20T22:03:39Z","updated_at":"2018-10-08T21:10:03Z","closed_at":null,"author_association":"NONE","body":"Consider the following program that I run with Go 1.5.2 on 64-bit Fedora Linux:\n\n```\npackage main\nimport \"fmt\"\nfunc main() {\n    a := make([]byte, 185 * 1024 * 1024)\n    for i := 0; i < len(a); i += 4096 {\n        a[i] = 'x'\n    }\n    fmt.Printf(\"%c\\n\", a[0])\n}\n```\n\nIt allocates 185MB byte array and then forces OS to commit memory to it via touching all the pages. This programs runs OK and prints expected `x` even if I restrict the size of available virtual memory per process to 200MB using ulimit:\n\n```\n~/s> ulimit -S -v 204800\n~/s> go run test.go\nx\n```\n\nNow consider its modification like:\n\n```\npackage main\nimport \"fmt\"\nfunc main() {\n    a := make([]byte, 85 * 1024 * 1024)\n    a = nil\n    a = make([]byte, 150 * 1024 * 1024)\n    for i := 0; i < len(a); i += 4096 {\n        a[i] = 'x'\n    }\n    fmt.Printf(\"%c\\n\", a[0])\n}\n```\n\nIt allocates first 85MB, then clears the reference to the slice, and then allocates 150MB. This time under the same 200MB limit as set with ulimit it fails:\n\n```\n~/s> go run test.go\nfatal error: runtime: out of memory\n```\n\nThe same failure happens even with the explicit GC call after a = nil:\n\n```\npackage main\nimport \"fmt\"\nimport \"runtime\"\nfunc main() {\n    a := make([]byte, 85 * 1024 * 1024)\n    a = nil\n    runtime.GC()\n    a = make([]byte, 150 * 1024 * 1024)\n    for i := 0; i < len(a); i += 4096 {\n        a[i] = 'x'\n    }\n    fmt.Printf(\"%c\\n\", a[0])\n}\n```\n\nIs it just a runtime bug?  If not, how can I force the runtime to release a large allocation?\n"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/427980212","html_url":"https://github.com/golang/go/issues/14045#issuecomment-427980212","issue_url":"https://api.github.com/repos/golang/go/issues/14045","id":427980212,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNzk4MDIxMg==","user":{"login":"gopherbot","id":8566911,"node_id":"MDQ6VXNlcjg1NjY5MTE=","avatar_url":"https://avatars1.githubusercontent.com/u/8566911?v=4","gravatar_id":"","url":"https://api.github.com/users/gopherbot","html_url":"https://github.com/gopherbot","followers_url":"https://api.github.com/users/gopherbot/followers","following_url":"https://api.github.com/users/gopherbot/following{/other_user}","gists_url":"https://api.github.com/users/gopherbot/gists{/gist_id}","starred_url":"https://api.github.com/users/gopherbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gopherbot/subscriptions","organizations_url":"https://api.github.com/users/gopherbot/orgs","repos_url":"https://api.github.com/users/gopherbot/repos","events_url":"https://api.github.com/users/gopherbot/events{/privacy}","received_events_url":"https://api.github.com/users/gopherbot/received_events","type":"User","site_admin":false},"created_at":"2018-10-08T21:10:03Z","updated_at":"2018-10-08T21:10:03Z","author_association":"NONE","body":"Change https://golang.org/cl/139298 mentions this issue: `runtime: separate scavenged spans`"}}
{"actor":{"display_login":"gopherbot"}}