{"action":"created","issue":{"url":"https://api.github.com/repos/iojs/io.js/issues/1522","labels_url":"https://api.github.com/repos/iojs/io.js/issues/1522/labels{/name}","comments_url":"https://api.github.com/repos/iojs/io.js/issues/1522/comments","events_url":"https://api.github.com/repos/iojs/io.js/issues/1522/events","html_url":"https://github.com/iojs/io.js/issues/1522","id":70909751,"number":1522,"title":"https.request memory usage grows to 500 MiB (rss)","user":{"login":"ChALkeR","id":291301,"avatar_url":"https://avatars.githubusercontent.com/u/291301?v=3","gravatar_id":"","url":"https://api.github.com/users/ChALkeR","html_url":"https://github.com/ChALkeR","followers_url":"https://api.github.com/users/ChALkeR/followers","following_url":"https://api.github.com/users/ChALkeR/following{/other_user}","gists_url":"https://api.github.com/users/ChALkeR/gists{/gist_id}","starred_url":"https://api.github.com/users/ChALkeR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChALkeR/subscriptions","organizations_url":"https://api.github.com/users/ChALkeR/orgs","repos_url":"https://api.github.com/users/ChALkeR/repos","events_url":"https://api.github.com/users/ChALkeR/events{/privacy}","received_events_url":"https://api.github.com/users/ChALkeR/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/iojs/io.js/labels/https","name":"https","color":"0052cc"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":24,"created_at":"2015-04-25T13:24:37Z","updated_at":"2015-04-26T10:42:46Z","closed_at":null,"body":"https.request leaks in this example:\r\n```javascript\r\n'use strict';\r\nvar https = require('https');\r\nvar options = {\r\n\thostname: 'google.com'\r\n};\r\nfunction next() {\r\n\tsetTimeout(iterate, 10);\r\n}\r\nfunction onError(error) {\r\n\tconsole.log(error);\r\n}\r\nfunction noop() {}\r\nfunction onResponse(res) {\r\n\tconsole.log('statusCode: ', res.statusCode);\r\n\tres.on('data', noop);\r\n\tres.on('end', next);\r\n}\r\nfunction iterate() {\r\n\tconsole.log(JSON.stringify(process.memoryUsage()));\r\n\tconsole.log('iterating...');\r\n\thttps.request(options, onResponse).\r\n\t\ton('error', onError).\r\n\t\tend();\r\n};\r\niterate();\r\n```\r\n`rss` grows over time, `heapUsed` remains about constant (~30m).\r\nThis could be reproduced with all released iojs versions that I tried v1.0.1 and v1.8.1.\r\n\r\nNode v0.12.2 behaves better in this testcase: rss grows to about 100m, but goes down periodically (I wouldn't call that a perfect behaviour, let's call that «fine»).\r\n\r\n53ba494, dad73f6 and 8a83eba are three sequental commits.\r\n53ba494 is fine (as 0.12), dad73f6 fails to build, 8a83eba leaks.\r\ndad73f6 is «upgrade v8 to 3.31.74.1» with 831 files changed, 104394 insertions(+), 21427 deletions(-).\r\nNode v0.12.2 could be fine because it still uses v8 3.28.73.\r\nio.js 1.0.0/1.1.0 + shared v8 3.30.33.16 behaves fine (the same as 0.12).\r\n\r\nAll the testcases and massif data are at http://oserv.org/bugs/iojs/memory0/"},"comment":{"url":"https://api.github.com/repos/iojs/io.js/issues/comments/96362373","html_url":"https://github.com/iojs/io.js/issues/1522#issuecomment-96362373","issue_url":"https://api.github.com/repos/iojs/io.js/issues/1522","id":96362373,"user":{"login":"ChALkeR","id":291301,"avatar_url":"https://avatars.githubusercontent.com/u/291301?v=3","gravatar_id":"","url":"https://api.github.com/users/ChALkeR","html_url":"https://github.com/ChALkeR","followers_url":"https://api.github.com/users/ChALkeR/followers","following_url":"https://api.github.com/users/ChALkeR/following{/other_user}","gists_url":"https://api.github.com/users/ChALkeR/gists{/gist_id}","starred_url":"https://api.github.com/users/ChALkeR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChALkeR/subscriptions","organizations_url":"https://api.github.com/users/ChALkeR/orgs","repos_url":"https://api.github.com/users/ChALkeR/repos","events_url":"https://api.github.com/users/ChALkeR/events{/privacy}","received_events_url":"https://api.github.com/users/ChALkeR/received_events","type":"User","site_admin":false},"created_at":"2015-04-26T10:42:46Z","updated_at":"2015-04-26T10:42:46Z","body":"2. No, that's not it. C++ objects are collected with an incremental gc if there are no obstacles. You can verify that with manually calling `process.binding('tls_wrap').wrap` — if you do nothing with the result, it gets collected."}}