{"id":20791305,"url":"https://github.com/theprofs/socket-mem-leak","last_synced_at":"2026-06-28T16:31:28.518Z","repository":{"id":78097283,"uuid":"82868947","full_name":"TheProfs/socket-mem-leak","owner":"TheProfs","description":"Test case for a socket.io memory leak, [FIXED] in: https://github.com/socketio/socket.io/issues/2872","archived":false,"fork":false,"pushed_at":"2017-02-26T10:49:23.000Z","size":70,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-29T08:34:03.930Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheProfs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-23T01:07:49.000Z","updated_at":"2017-12-05T08:19:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"90c08d51-b4bc-45a0-9c99-e49a7743335a","html_url":"https://github.com/TheProfs/socket-mem-leak","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TheProfs/socket-mem-leak","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheProfs%2Fsocket-mem-leak","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheProfs%2Fsocket-mem-leak/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheProfs%2Fsocket-mem-leak/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheProfs%2Fsocket-mem-leak/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheProfs","download_url":"https://codeload.github.com/TheProfs/socket-mem-leak/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheProfs%2Fsocket-mem-leak/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34896652,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-28T02:00:05.809Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T15:43:08.970Z","updated_at":"2026-06-28T16:31:28.487Z","avatar_url":"https://github.com/TheProfs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# socket-mem-leak\n\u003e Test case for a socket.io memory leak, tracked as an Issue [here][1].\n\n## Problem\n\n- When there's no enforcement to use \"Web Sockets\" *only* as the transport\nprotocol, the server logs a memory spike (\u003e 500%) when emitting a big sample\nJSON.\n\n- When \"Web Sockets\" *only* are enforced, the server logs\nnominal memory consumption values whilst emitting the sample JSON.\n\nThe problem seems to lie with the initial XHR handshake.\n\n\n## Usage\n\n- Clone repo and then:\n\n```bash\n$ npm install\n```\n\n- Running with default Transport protocol\n\n```bash\n$ node --expose-gc index.js\n```\n\n- Enforcing WebSockets-only Transport protocol\n\n```bash\n$ WS_ONLY=true node --expose-gc index.js\n```\n\nThen visit [http://localhost:3000](http://localhost:3000) and pop-open the console.\n\n\n## Metrics:\n\n\u003e Without enforcing WebSockets-only\n\n```bash\nListening on 3000, using default Transport\nUsed heap size 34.91 MB\nnew connection\nemitting 10 MB payload\nUsed heap size 659.31 MB\nUsed heap size 659.50 MB\nUsed heap size 659.56 MB\nUsed heap size 659.56 MB\nnew connection\nemitting 10 MB payload\nUsed heap size 593.52 MB\nUsed heap size 593.65 MB\nUsed heap size 593.68 MB\nUsed heap size 593.68 MB\n\n```\n\n\u003e Enforcing WebSockets-only\n\n```\nListening on 3000, using WebSocket only\nUsed heap size 34.92 MB\nnew connection\nemitting 10 MB payload\nUsed heap size 54.68 MB\nUsed heap size 54.68 MB\nUsed heap size 54.68 MB\nnew connection\nemitting 10 MB payload\nUsed heap size 43.93 MB\nUsed heap size 43.97 MB\nUsed heap size 43.98 MB\nUsed heap size 43.98 MB\n```\n\n\n[1]: https://github.com/socketio/socket.io/issues/2872\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheprofs%2Fsocket-mem-leak","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheprofs%2Fsocket-mem-leak","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheprofs%2Fsocket-mem-leak/lists"}