3 ms·
If there is a memory leak, then yes, memory usage would increase as your program continues making progress. That's like saying: "I run my program and it works,
by gnulinux 6y ago
If there is a memory leak, then yes, memory usage would increase as your program continues making progress.
That's like saying: "I run my program and it works, how can I have bugs??"
Unless you know how to properly test, of course you won't be able to find memory leaks and memory usage will stay the same. Do you click the same thing 5000 times and observe every time memory is cleaned? Do you have unittests against this?
Idk, long story short "I don't know how to make memory leaks in javascript, so I must not have them" is non sequitur.
- Kiro 6y agoWell, I have zero unit tests so there's that. > Do you click the same thing 5000 times and observe every time memory is cleaned? I don't know how to check that but not sure I understand. If it really was a memory leak the hundred of requests a second I get would surely make the app consume the whole server's memory eventually. I don't need to click stuff 5000 times to test that. It's happening in production as we speak. Just to clarify, it's a single-threaded Node process and its memory consumption has stayed the same for weeks, since the last time I restarted it.
- jonathanlydall 6y agoIt seems highly unlikely you have a memory leak as it doesn’t sound like you are observing continually increasing memory usage. I’ve worked a lot in C# and JavaScript and I’ve only had to watch out for memory leaks with event aggregators for messaging between UI components. So the UI has a button to start a use case. Each time the user goes into the use case a new object is created which on construction registers a callback against an event type with the event aggregator. The memory leak occurs if this callback is never de-registered on completion of the use case, since the callback is holding onto a reference to the new object created at initiation of the use case. If the use case is called repeatedly (think something like a check-in terminal), eventually the memory is exhausted. On backends I’ve only ever worried about potential memory exhaustion from things like unbounded caches.