ipyaggrid memory leak
Hi, I have an app that uses a few sizeable
ipyaggrid
grids (one per tab) that are leading to memory leaks (when I replace them with solara.Dataframe
's for example, then there is no leak). I am using a AgGrid
component with a cleanup
function, along the lines below, and it seems to be improving things but wanted to know if there is a better approach, on either python and JS side (using js_post_grid
) ?
5 Replies
Hi @Cyrus, can you provide the steps to reproduce the growth in memory use? And is it in python or in the browser?
Browser. At first I was just hovering over the Google Chrome browser tab and noticing the memory go from say 50Mb when the page first loads to the 1GB range after using the grids for a few minutes. Then I added the cleanup function above and now it goes up to a more reasonable 300-400 Mb range after heavy use. I also used Chrome's Performance-Insights developer tool where you can get a graph of performance metrics over time. It is hard to provide the exact example as the data is proprietary. I have about 5 grids that vary between 50k to 300k rows, each grid behind a separate solara.lab.Tab() with lazy=True so they don't all load in memory at the same time. To mimic this in the example above you can edit the end to be
My actual grids are also using more columns and features like grouping, or rendering SVG within cells, etc
Thanks! I could reproduce the issue and it is now fixed in ipyaggrid 0.5.4.
That's great!
Does that mean I no longer need the
cleanup
function?The cleanup function is indeed not needed, this is handled automatically in solara.