Find memory leak in express js application

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video you will learn how to find memory leak in your express.js application here I will show you how to enable debugger mode in your express.js application to get the memory dump and then how to use Google Chrome to get the memory snapshot and compare the data here I have created a simple express.js application there are two files one is server.js and another Rich package.json so in the server.js I've created a express route Heap so once you hit this route this will create a global variable hello list which will basically has some data and we will use this variable to inspect Heap memory later on in this video now open package.json look for the line number 7 and the start script the first command is node the second flag is dash dash inspect so this flag basically enables the debugger mode in the express.js application and the third command is the path to your server.js file now start this application npm Run start here you will see message that debugger is listening on this URL and this application has been started on the port 3000 now open Chrome and then Chrome developer tools in the top left corner you will see a green icon this icon is for node.js click on this icon and you will see a separate window for node.js tab tools here you will see a memory tab is by default selected in the left you will see profiles and in the right section you will see Heap snapshot it by default selected scroll down to see more information at the bottom you will see two buttons take a snapshot and a load so now just click on take a snapshot it will create an initial snapshot for your application now open the row to create the Heap memory the localhost 3000 and then Heap go back to the dev tools again and click on the profiles and you will see some memory has been added to the Heap now the memory is 13.7 MB click on the button take a snapshot again it will create another snapshot now in the right evil see summary click on this drop down and click on comparison in the right you will see another drop down where you will see snapshot one and you will see two options so right now as we are comparing snapshot one with two so just keep snapshot one selected click on the array and click on the first element and in the bottom expand that array and you will see that hello list is added in the global variables that brings to the end of this video thanks for watching
Info
Channel: Level Up Lab
Views: 3,638
Rating: undefined out of 5
Keywords:
Id: YsF1rCIkCRM
Channel Id: undefined
Length: 2min 31sec (151 seconds)
Published: Sun Oct 16 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.