[Bug]: plt.figure(), plt.close() leaks memory · Issue #23701 · matplotlib/matplotlib · GitHub
Skip to content

[Bug]: plt.figure(), plt.close() leaks memory #23701

Description

@nschloe

Bug summary

MWE:

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) to get

screenshot

Might be related to #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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions