-
Book Overview & Buying
-
Table Of Contents
Mastering Web Application Development with Express
By :
Memory leaks are one of the nastiest bugs you can encounter in your applications. That's because they are usually hard to track down, since some of them can take days to build and require certain conditions to be met.
The heapdump (https://www.npmjs.org/package/heapdump) module allows us to take heap snapshots programmatically, so we can inspect them at a later point in time. The snapshots will be saved in the current working directory and will have the heapsnapshot file extension.
Let's create a sample application that stores a lot of new objects into an array with each request made. The application will check for the memory usage every minute and compare it with the threshold; if it's bigger than the threshold, then a heap snapshot will be written to the disk, and the threshold will be augmented with another 100 megabytes; otherwise, it does nothing.
The full code for the application will thus be the following:
var heapdump = require('heapdump');
var express = require...
Change the font size
Change margin width
Change background colour