Best practice to troubleshoot Heap usage #5157
-
Other than using the VScode extension Flame Chart Visualizer for JavaScript Profiles, how should one go about reviewing the amount of memory Hexo consumes? I have over 1400+ post (over 9400 files) that take about 70sec to generate but consumes over 14GB(!) of memory. When I use the default theme, it's able to process everything under 4GB. Total folder size of all assets is less than 4GB. I'd like to figure out why it takes another 10GB of memory under the new theme I'm building. Not just troubleshooting Hexo, but how to troubleshoot EJS files? The debugger doesn't exactly pause anywhere within the EJS files (as it does for the node_modules JS files...). Reference
Related |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
It sounds like your theme is leaking memory. You can use this tool to debug any performance issue (including memory leak): https://clinicjs.org/ |
Beta Was this translation helpful? Give feedback.
-
I figured out the issues I had with VScode not attaching to the nodeJS process running HEXO. Now when I run the (vscode) debugger with the FlameChart extension, I can see the active heap usage along with CPU consumption. Here's the VScode {
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "HEXO server",
"program": "${workspaceFolder}/node_modules/hexo-cli/bin/hexo",
"args": [
"server",
"-p 4000"
],
"restart": true,
"runtimeExecutable": "node",
"runtimeArgs": [
"--inspect"
],
"stopOnEntry": true,
"sourceMaps": true,
"cwd": "${workspaceFolder}"
},
{
"type": "node",
"request": "launch",
"name": "Hexo generate",
"program": "${workspaceFolder}/node_modules/hexo-cli/bin/hexo",
"args": [
"generate"
],
"sourceMaps": true,
"cwd": "${workspaceFolder}"
}
]
} 📝 I'm also updating my blog on how to debug Hexo themes and plugins... |
Beta Was this translation helpful? Give feedback.
I figured out the issues I had with VScode not attaching to the nodeJS process running HEXO. Now when I run the (vscode) debugger with the FlameChart extension, I can see the active heap usage along with CPU consumption.
Here's the VScode
launch.json
config: