Memory usage climbs with Socket.io included - memory leak
See original GitHub issueYou want to:
- report a bug
Basic usage of socket.io causes incremental memory usage (about +4mb every second). Even when nothing is transmitting. I have found that if I comment out socket.io my app no longer has this memory issue. Meaning the only thing that causes it is socket.io.
Current behaviour
Memory will keep climbing if socket.io is in use (about +4mb every second)
. I am using it to transmit ArrayBuffer data of an image every few seconds (CCTV monitoring).
If a user connects to watch a stream it will climb faster. Sometimes 10mb per second
. Which makes sense as I am transmitting images over socket.
Steps to reproduce (if the current behaviour is a bug)
just create a fresh node app with socket.io and watch the ram usage just go up for no reason.
Expected behaviour
Meant to purge sent data after its done sending (but it doesn’t i am guessing)
Setup
- OS: Ubuntu 16.04 Server, Installed an old Macbook (white) Core 2 Duo… with i think either 1GB ram or 2GB ram… (the thing is gutless)
- browser: Chrome -
Polling disabled in socket.io.js
(but the issue is not directly the fault of the user, they just connect and get data) - socket.io version: 1.7.1
- node : v4.2.6
- npm : 3.5.2
Other information (e.g. stacktraces, related issues, suggestions how to fix)
I have tried global.gc()
but it returns as an undefined function even with --expose-gc
. I have read in countless places shouldn’t do that anyway so I am hoping there is a way to purge the old/temp/cached
data from memory. It would be nice to specifically target the data socket.io is leaving in memory.
Perhaps there is an object that i just delete()
… man that would be nice eh?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:5
- Comments:5 (2 by maintainers)
Top GitHub Comments
Could you please share some code? Is the memory climbing forever (well, until process crashes)?
So… can you close the issue please?