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 due to a circular dependency between Triangulation and TriFinder #28447

Open
Milestone
@Baljak

Description

@Baljak

Bug summary

InTriangulation, when callingget_trifinder, the trifinder is stored isself._trifinder, howeverTriFinder itself also stores a reference to the triangulation inself._triangulation. As a result, neither object is ever destroyed.

Code for reproduction

importmatplotlib.triastriimportnumpyasnpimportpsutiln_points=500000x=np.random.rand(n_points)*100y=np.random.rand(n_points)*100whileTrue:triangulation=tri.Triangulation(x,y)trifinder=triangulation.get_trifinder()mem=psutil.virtual_memory().available*100/psutil.virtual_memory().totalprint(f"Available memory:{mem:.2f}%")

Actual outcome

Available memory: 75.65%
Available memory: 69.80%
Available memory: 63.91%
Available memory: 58.04%
Available memory: 52.15%
Available memory: 46.27%
Available memory: 40.40%
Available memory: 34.53%
Available memory: 28.65%
Available memory: 22.87%
Available memory: 17.03%
Available memory: 11.12%
Available memory: 6.25%
Available memory: 0.95%
Available memory: 0.62%
Available memory: 0.73%
Available memory: 0.95%
Available memory: 0.90%
Killed

Expected outcome

The memory should remain the same after each iteration.

Additional information

The_triangulation attribute in TriFinder is never actually used and can be safely removed: this fixes the issue.

Operating system

Linux (Debian 12), Windows

Matplotlib Version

3.9.0

Matplotlib Backend

qtagg

Python version

3.11.2

Jupyter version

7.1.2

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp