-
Notifications
You must be signed in to change notification settings - Fork 364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory Leak and/or Sessions not Cleaned Up #3623
Comments
Thanks for the issue, i have what could be a fix here (#3627), but haven't tested the memory is reclaimed. I will try to test manually on my end |
@mixxen, we are still investigating. Could you try |
Thanks for looking into this. I tried running Marimo with
|
This change fixes a memory leak in run mode in which a kernel's globals memory appeared to not be freed on session (thread) exit. However, another (smaller) leak appears to still exist. This change also makes sure to stop the stream's buffered writer thread when kernel exits. Also, add a TODO for performance of VariableValue construction -- calling str() on some values, such as a bytearray of size 1GB, can make memory usage spike to 25GB. Hopefully improves #3623 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
I'm having pretty severe memory leakage too... to the point i can't really use this on my machine until it's fixed. It sounds like y'all are on the path to a fix but let me know if i can be of any debugging service. attaching a bit from my dev logs just in case edit: y'all are the fastest paced open source project out here fr fr |
@schlich. is this in marimo run or edit? we have lots of fixes coming in both and will release them out today! |
It was edit |
@schlich — is there anything else you can share?
The changes we pushed likely won't fix a leak in edit mode, which is why I ask. Thanks! |
I wish i could tell you more info, i'll do my best but i've been playing with enough configuration that it seems to have worked itself out.
|
Impressed at the agility of this team! I just tried the new version and it still exhibits the same issue. I ran my test, closed all windows, and left the server running overnight. When I got back, it was still consuming memory and CPU:
I'll try putting together a similar stressing UI to reproduce this issue for you to try. |
Thanks for trying, any kind of reproduction would be very much appreciated! |
I've tracked down the resource leak to this setting in
I initially created a toy app to reproduce the memory leak here, https://github.com/mixxen/marimo-stress, but I did not see a memory leak. So I went back to our original application and removed all components until there were none, and it still leaked memory. I traced it down to the Hope that helps. |
That's extremely helpful. I will investigate. Thank you! |
Describe the bug
We are using Marimo to provide a user interface dashboard for our users. The app has multiple tables, multiple forms, and a few Altair data visualizations. It also uses Polars to cache data for the application.
We've noticed that after a short period, Marimo consumes a huge amount of memory. After investigation, we found that every time we refresh the page, Marimo allocates more memory and consumes more CPU, eventually saturating the host resources and becoming extremely slow and unusable.
Below you can see Marimo's memory usage after refreshing the page 10 times. In this test, there is no data in the Polars data frames:
Here is a Grafana view on our server over a couple of hours (just testing with a couple of users). The data in the Polars data frames is very minimal for this test:
Memory consumption spikes when someone hits the dashboard. After they exit, memory is not reclaimed, and over time, the app becomes noticeably slower.
We tried running Marimo like this:
I've searched the documentation and issues for anything regarding session cleanup, etc. I did not find anything. We could use help to determine if this is a bug in Marimo or if we are doing something incorrectly on our end. Marimo is a pretty great idea; thank you in advance.
Environment
Code to reproduce
No response
The text was updated successfully, but these errors were encountered: