Long-running go application experiencing memory leak using rod #1124
-
Hi, we have a web-scraping tool that uses rod to launch browsers. After each session we close the browser, however I have noticed that the application slowly builds up reserved memory which is only released after the application is restarted. Upon inspection I can see very many instances of chrome_crashpad running on the server. I have tried running the browser in leakless mode, but I think that is only valid for closing chrome after the main thread is closed. Is there anything I can do to get rod to release the memory after the bowser is closed? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I managed to find the problem and solve it. In case anyone else experiences this issue or similar, here is the solution.
I hope this helps others in need ;) |
Beta Was this translation helpful? Give feedback.
I managed to find the problem and solve it. In case anyone else experiences this issue or similar, here is the solution.
To prevent chrome_crashpad from running, I had to launch the browser with the following flags:
.Set("--single-process").Set("--disable-crashpad-for-testing")
I used the following flags to ensure chrome releases memory when pages are closed:
.Set("--aggressive-tab-discard").Set("--aggressive-cache-discard")
I had to call .Close() on any new page (NOTE: closing the browser in rod does not seems to release the memory from pages that are not closed by calling .Close().
Finally, after calling .Close() on the browser, you have to call .CleanUp() on the launcher. It se…