FOSSASIA
V8 Memory Analyzer
V8 is an open source Javascript engine developed by Google. Its the JS engine used in the popular web browser Google Chrome and also in NodeJS. In this task you will write a Javascript script to analyze the heap memory allocated by V8 on NodeJS.
Preparation
- Search the Internet using keywords heap vs stack memory and make sure you understand what heap memory is to a good extent.
- Use Google Chrome's developer tools to take a snapshot of the heap memory on V8 inside Google Chrome. Refer to this or any other resource on the subject readily available on the Internet to know how.
- Note that in previous step you are analyzing the V8 instance inside Google Chrome. In this task you will write a script to do the same for NodeJS.
- Learn Terminology.
Steps
- Write a small package with a single script that use v8-profiler npm package's heap snapshot api
- You can use
export
method to get a serialized output (a JSON string) of the snapshot. - There are not much documentation to understand the format of the serialized output, but you can use V8 source code to get some idea. (Its in c++).
- Extend your script to count deferent types of nodes (String, Array, regexp,....etc) and calculate allocated memory to each type.
If you need help on any step after going through preparation ask for help by commenting here or pinging @roonyh on #fossasia.
Task tags
Students who completed this task
atul009, Dhruv Ramani