nicegui icon indicating copy to clipboard operation
nicegui copied to clipboard

Memory leak in `ui.line_plot`?

Open rodja opened this issue 2 years ago • 0 comments

The NiceGUI documentation at https://nicegui.io is written with NiceGUI itself. So it's a good testbed to see how well the lib performs with a lot of visitors. One thing we see quite regular is this error message:

/usr/local/lib/python3.10/site-packages/nicegui/elements/plot.py:18: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (matplotlib.pyplot.figure) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam figure.max_open_warning). Consider using matplotlib.pyplot.close().

When looking at the code, the ui.plot seems to be ok. By default figures are closed when their context is exited. But with ui.line_plot new data can be added to the plot. Could this be the root cause of the warning?

rodja avatar Oct 16 '22 03:10 rodja