Welcome to DenoSoar
Denosoar is an open source memory tool that is used to track potential memory leaks for applications built with Deno. Denosoar analyzes and displays in real time the RSS(resident set size), Heap Total, Heap Usage and External Memory using easy to read charts.
If you find yourself here, you probably already have a memory leak. You'll know this when your app slows or crashes unexpectedly. In JavaScript and TypeScript applications, memory leaks are typically caused by the growth of the heap over time. The four main culprits of memory leaks in these applications are accidental global variables, closures, event listeners, and timers like setTimeout or setInterval. Navigate here to learn more about memory leaks in JavaScript applications.
Before the release of Denosoar 1.0.0, Deno had no memory debugging libraries. Deno's internal function memoryUsage also returned an incorrectly labeled variable for Resident Set Size. Denosoar solves both of these issues and provides an easy interface for you to sample memory statistics in your server over long periods of time and digest these files into clear, interactive graphs.
Getting started
To get started, first install the Denosoar library from deno.land:
deno install --allow-read --allow-write --allow-net --allow-env --allow-run --name denosoar https://deno.land/x/denosoar@v1.0.0/mod.ts
denosoar --example
Guide
Initializing Denosoar in Your App
Inside of your entrypoint server file, import the denosoar init function:!--frsh-copytoclip:3-->Then, invoke the init function inside of your entrypoint server file passing in an unused localhost port as the only argument. For example:import { init } from "https://deno.land/x/denosoar@v0.0.4/mod.ts";
Copied!!--frsh-copytoclip:4-->The port should only be the number, not the entire url. This init invocation will spin up a lightweight denosoar server inside of your application, sharing memory and a process id with your application. Make sure that the port you invoke init with is the same port you connect to on the GUI. Here, we would connect to port 3001 on the front end.init(3001);
Copied!Record Memory
If you would like to generate a .csv file of the memory statistics generated by denosoar, you can click the Start Recording button on the GUI when connected to a denosoar server. This will generate a .csv file named for the current date inside the directory where denosoar's server was initialized with the invocation of init. You can also begin recording utilizing the command line iterface. After installing denosoar and making sure it is added to your path, execute the following command:!--frsh-copytoclip:5-->Where the port number is the port you initialized the denosoar application with inside your server. You must have a running denosoar server listening on this port or else the command will fail. You can also stop recording by either clicking the Stop Recording button on the GUI or by executing the following command:denosoar --start-record port-number
Copied!!--frsh-copytoclip:6-->denosoar --stop-record port-number
Copied!Processing .csv Files
Processing your .csv files is as easy as dragging and dropping the file into the front-end GUI in the "Upload Chart" section. This will produce a memory graph of the entire dataset. If you would like to process the .csv files on your own, each row is organized into x (being time in seconds since recording began), committed, heapTotal, heapUsed, exteranl, and rss. They are always generated in this order. The first line is the headers for the rest of the data.Change the Frequency of Data Sampling
To change the frequency of data sampling, simply execute the following command:!--frsh-copytoclip:7-->The default sampling frequency will be one data point every fifteen seconds. You must have a denosoar server listening at the requested port for this command to function. Desired frequency must be a number.denosoar --freq port-number desired-freq
Copied!Beta - Perform a Simple Load Test
Denosoar offers a Beta Load Testing tool. It is not sophisticated, or very customizable but in it's current state it can still stress an application enough speed up the time needed to see a memory leak. To perform a load test, execute the following command:!--frsh-copytoclip:8-->You can also navigate to the GUI and use the Load Testing bar that appears beneath the live memory graph on the home page. Make sure you have connected the front end to your port, first.denosoar --lt full-url concurrency rps duration
Copied!
Under Development
Heap Snapshots
Take and save snapshots of your heap with the click of a button.
Comparative Snapshot Analysis
Analyze heap snapshots to pinpoint objects that are likely culprits of memory leaks.
Core Dump Analysis
Analyze core dump files after application crashes.
CPU Usage Analysis
Analyze the CPU Usage of your application over time and under stress.