Skip to content

[Bug]: macOS backend leaks NSTrackingArea #31754

Description

@iccir

Bug summary

Assuming that #31751 is fixed, the macOS backend will still leak the NSTrackingArea created in FigureCanvas_init.

Code for reproduction

import matplotlib.pyplot as plt
plt.subplots()
plt.show()

Actual outcome

A NSTrackingArea object has a retainCount of +2. After the view hierarchy is dealloc'd, the retainCount is still +1.

Expected outcome

The NSTrackingArea is freed when the view hierarchy is freed.

Additional information

No response

Operating system

macOS 14.7

Matplotlib Version

0.2.0.dev54528+unknown.gf4cf12592.d20260526

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Installation

None

Activity

  1. QuLogic commented on May 27, 2026

    @QuLogic
    Member

    I think this is fixed by #31661.

  2. linked a pull request that will close this issueBLD: add more static analysis #31661on May 27, 2026
  3. iccir commented on May 28, 2026

    @iccir
    ContributorAuthor

    Yep, that PR fixes it and I have the same fix in my fork. I'll try to figure out how to back it out before submitting my PR for the other memory-relate issues.

  4. added this to the v3.11.0 milestone on Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions