I have a JavaScript program (Node.js), which is working 100% fine, however recently I realized it is leaking memory, most likely from several different areas, likely due to closure pattern, and exacerbated by Promise library to handle async stuff. So it can benefit highly from some code review.
I know buggy code is off topic in this site -- are leaks falling under bugs for that classification? Only reason I am not sure is the program working 100% as expected (up until point where memory gets exhausted). I know closure pattern is common source of leak for JS so I figured there maybe a lot of knowledge here (rather than S.O. which maybe geared more toward 'just make it work')