Memory Leak / Ram usage increasing


Dear Adonis Members,

Today i find out that my project eating huge ram usage after 3 days and i suspect maybe memory leak. I try to heap snapshot new app (adonis new yardstick) and the result is it keep increasing ram usage.


The question is, is it normal or is it memory leak ?

Sorry, my english is not good.

Thank you so much,


  1. Is it a plain app or you have written your own code too?
  2. How do you generate snapshots?
  3. What’s the frequency of generating snapshots?


Hello Virk,

  1. Plain app
  2. i use node --inspect server.js
  3. I refresh app around 3-5 times, after that i take snapshot

Thank you


Can you wait for a minute between generating snapshots, since GC doesn’t kick too early to cleanup old memory.

  1. Open webpage
  2. Take snapshot
  3. Wait for a minute
  4. Redo step 1,2


Ok will test it again, you are right maybe thats the problems :sunny:


@virk I use 10 minutes before next request. Here is the result:

Thank you


Couple of things first.

  1. It is so hard to tell, when GC will kick in to clean old memory. It all depends upon, how aggressively memory is increasing. So for fewer jumps, GC will not kick in early

  2. Also manually hitting a webpage doesn’t tell the real story. So instead I load tested it.

Load testing

  1. Start server node --inspect server.js.
  2. Install autocannon for load testing npm i -g autocannon.
  3. Send traffic for 60sec. autocannon -c 1 -d 60 http://localhost:3333
  4. Take heap snapshots, after every 20%.

As soon as load testing process finishes, the memory is released and hence there is no memory leak.

That’s not the complete story

The above output is when I am not rendering views. When I use Edge to render the views, their a huge spike in memory and it is never released. Which means Edge does have a memory leak and I am looking into it


This seems to be a deeper issue at v8 level reported earlier by many other authors.

And then I also created an issue with the Node team.

The answer is, Edge has to handle it in a way that memory leak doesn’t happen. It will require some deep changes, so you might have to wait for a while.

Also as per the comments, the memory does get claimed but after a long long time. So ideally your server will not run out of memory but yes, some amount of memory will be eaten.


@virk you are right my server is not run out of memory and i’m happy with it :slight_smile:

Hope adonis will become famous nodejs framework…

Thank you so much