Skip to content

Reference leak in capi_call_instrumentation() for non-LINE monitoring events #150379

Description

@lpyu001

Bug report

Bug description:

#instrumentation.c: PyLong leaked per C API monitoring call

capi_call_instrumentation (line 2609) creates offset_obj = PyLong_FromLong(offset) stored in args[2] but never calls Py_DECREF. Affects ~16 _PyMonitoring_Fire*Event C API functions. Unbounded memory growth in long-running apps using C monitoring.

This is a sub-issue of #146102 with gist details

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows

Linked PRs

Activity

  1. added a commit that references this issue on May 25, 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

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions