jay What makes you believe that there is a memory leak? Each object is created per request and should be GCed after the request is complete.

I ran the code via node-inspector with apache-benchmark to see the problem of memory leak and did not find any issue. Below is the snapshot of the GC from the start and then from the end. Things look ok to me.

[27998:0x102803c00] 2219625 ms: Mark-sweep 116.1 (165.6) -> 81.7 (154.6) MB, 61.9 / 0 ms [HeapObjectsMap::UpdateHeapObjectsMap] [GC in old space requested].
[27998:0x102803c00] 2222878 ms: Mark-sweep 145.7 (181.6) -> 88.1 (167.6) MB, 68.1 / 0 ms [HeapObjectsMap::UpdateHeapObjectsMap] [GC in old space requested].
[27998:0x102803c00] 2223750 ms: Mark-sweep 110.3 (167.6) -> 89.4 (149.6) MB, 72.2 / 0 ms [HeapObjectsMap::UpdateHeapObjectsMap] [GC in old space requested].
[27998:0x102803c00] 2224636 ms: Mark-sweep 112.1 (151.6) -> 90.7 (151.6) MB, 66.6 / 0 ms [HeapObjectsMap::UpdateHeapObjectsMap] [GC in old space requested].
[27998:0x102803c00] 2224963 ms: Mark-sweep 99.4 (151.6) -> 90.7 (144.6) MB, 66.8 / 0 ms [HeapObjectsMap::UpdateHeapObjectsMap] [GC in old space requested].
[27998:0x102803c00] 2225242 ms: Mark-sweep 99.6 (144.6) -> 64.1 (142.6) MB, 48.5 / 0 ms [HeapObjectsMap::UpdateHeapObjectsMap] [GC in old space requested].
[27998:0x102803c00] 2225510 ms: Mark-sweep 68.3 (142.6) -> 58.0 (114.6) MB, 53.5 / 0 ms [HeapObjectsMap::UpdateHeapObjectsMap] [GC in old space requested].
[27998:0x102803c00] 2225744 ms: Mark-sweep 59.7 (114.6) -> 58.0 (109.6) MB, 47.3 / 0 ms [HeapObjectsMap::UpdateHeapObjectsMap] [GC in old space requested].

--

--

--

Senior Staff Engineer @freshworks. Ex-McKinsey/Microsoft/Slideshare/SAP, Tech Enthusiast, Passionate about India. Opinions are mine

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Abhinav Dhasmana

Abhinav Dhasmana

Senior Staff Engineer @freshworks. Ex-McKinsey/Microsoft/Slideshare/SAP, Tech Enthusiast, Passionate about India. Opinions are mine

More from Medium

Depression & Pain

A Lover to Keep Me: Saint.

I Am Your Reckoning

First Lady Fashion, Melania Trump Fashion : Life Style Big News