question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Memory usage climbs with Socket.io included - memory leak

See original GitHub issue

You 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:closed
  • Created 7 years ago
  • Reactions:5
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
darrachequesnecommented, Dec 1, 2016

Could you please share some code? Is the memory climbing forever (well, until process crashes)?

0reactions
darrachequesnecommented, Dec 2, 2016

So… can you close the issue please?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Socket.io and node.js, can't understand memory usage
I try to track a memory leak in my app, I'm not sure, but I think socket.io is a part of my problem....
Read more >
How to fix ws and socket.io memory leak? - Server Fault
1 Answer 1 · the ws node. · the zlib module has had a problem in the past relating to memory fragmentation, which...
Read more >
Memory leaking only with Node.js agent installed
The memory leak in its current state is believed to be an issue node core. The problem is some OpenSSL (and node) objects...
Read more >
Understanding Garbage Collection and Hunting Memory ...
A look into how Node.js manages memory with garbage collection. ... run is constantly climbing, which is a clear indication of a leak....
Read more >
Top 10 most common Java performance problems
AOL homepage I watched our session counts start climbing from ... Memory Problems: Java memory management is ... configuration and memory leaks.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found