facebook / memlab

A framework for finding JavaScript memory leaks and analyzing heap snapshots
https://facebook.github.io/memlab/
MIT License
4.36k stars 119 forks source link

MemLab cannot analyze heap across page reloads #20

Closed applesaucesome closed 1 year ago

applesaucesome commented 1 year ago

I'm trying to use Memlab on my app that is login protected. The login process causes a redirect to the login page and then redirects back to my app after a successful login. This causes the error "The page is reloaded. MemLab cannot analyze heap across page reloads. Please remove window.reload() calls or disable any reload logic."

Are there any plans to enable Memlab to work with apps that have this login flow?

JacksonGL commented 1 year ago

@applesaucesome MemLab test scenario (with action and back callback) finds memory leaks by diffing heap snapshots. If the web page reloads, diffing heap snapshot doesn't make sense since browser refreshes the JS heap.

Have you tried the cookies callback?

We may be able to support start checking reload after the setup call so you can do the login with reloading inside the setup callback.

MemLab also supports finding memory leaks based on a single heap snapshot taken manually from Chrome.

memlab view-heap --snapshot <path to .heapsnapshot file>
applesaucesome commented 1 year ago

@JacksonGL I'll give these alternate approaches a try, thank you!! Also, I support the idea of being able to pick when the check starts, like you're suggesting. I think it could be a more flexible approach for these login/redirect scenarios.