### Bug summary MWE: ```python import matplotlib.pyplot as plt while True: plt.figure() plt.close() ``` Either run this code and monitor the mem consumption on top, or run ``` mprof run test.py mprof plot ``` (with [memory-profiler](https://pypi.org/project/memory-profiler/)) to get  Might be related to https://github.com/matplotlib/matplotlib/issues/22448. ### Operating system Ubuntu 22.10 ### Matplotlib Version 3.5.3 ### Matplotlib Backend GTK4Agg ### Python version 3.10.6 ### Jupyter version _No response_ ### Installation pip