Fork me on GitHub
#nbb
<
2023-09-23
>
jaide06:09:51

Before I can start drafting the nrepl middleware, I gotta finish this client project. The last post-launch issue is that I'm hitting the memory limits of the free tier of http://fly.io. This mostly happens when the administrative deploy route is hit to fetch updated content from a headless CMS, then parsing it to download static assets. I'm using bacon so it's happening asynchronously & concurrently but sometimes it spikes, hits the 300 mb memory limit, and dies. When idle, the site seems to run just fine. If I remember right, node can be ran against a chromium debugger with some cli flags or env vars. If I could somehow get the avg memory used waiting for a specific promise to resolve, I could find the more memory-hungry parts I think. Anyway, anyone have experiencing profiling memory usage in node or nbb?

Chris McCormick10:09:46

It was a while back but I've done this before when tracking down a memory leak in a component of webtorrent. I was able to dump the profile using a node flag, download it from the server, and then import it into Chrome to visualize. Let me see if I can dig up the ticket.

Chris McCormick11:09:38

Ah, here's the ticket where I used the node profiler to debug a memory leak: https://github.com/mafintosh/k-rpc/issues/13 There's not much detail on there about how, but I think I just used --prof and then you download the dump file and import into Chrome in the profile tab.