Skip to content

Async Responses Structured Outputs Memory leak #3084

@savvasp-123

Description

@savvasp-123

Confirm this is an issue with the Python library and not an underlying OpenAI API

  • This is an issue with the Python library

Describe the bug

Using the AsyncResponses client to parse structured outputs there are pydantic models left behind which causes memory to accumulate. Flame graph of the memory leak:

Image

To Reproduce

  1. Use the Async Responses .parse() API with a Pydantic model
  2. Send large Base 64 Images in the messages using data URIs
  3. The memory is not freed

Code snippets

OS

macOS

Python version

Python 13.7

Library version

openai v2.31.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions