Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Bug]: Memory leak with colorbar.make_axes #22085

Closed
@vdrhtc

Description

@vdrhtc

Bug summary

When usingmatplotlib.colorbar.make_axes function,plt.close() does not clear the new colorbar axes from memory. Tested for the Qt5 backend only. Maybe related to#22002, at least in the sense that I see no leak for Qt5 when no colorbar axes are added.

Code for reproduction

%pylabqt5frommatplotlibimportcolorbarimportpsutilimportgcp=psutil.Process()foriinrange(5):fig,ax=plt.subplots(1,1)ax.imshow(random.normal(size=(100,100)))cax=colorbar.make_axes(ax)plt.savefig("test.png")plt.pause(0.1)plt.close(fig)delfigdelaxdelcaxgc.collect()print(p.memory_full_info().uss/1e6)

Actual outcome

250.744832
255.209472
259.514368
264.13056
268.099584

Expected outcome

Constant memory usage, as is when the line
cax = colorbar.make_axes(ax)
is commented out.

Additional information

No response

Operating system

Windows

Matplotlib Version

3.4.2

Matplotlib Backend

Qt5Agg (PyQt)

Python version

3.7.6

Jupyter version

No response

Installation

from source (.tar.gz)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp