3 ms·
Well, 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 tha
by Kiro 6y ago
Well, 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.