Skip to content

fix(sync): clear __pw_stack__ on task completion to prevent memory le… - #3158

Open
atiqur-rahman-pro wants to merge 1 commit into
microsoft:mainfrom
atiqur-rahman-pro:fix/sync-pw-stack-leak-3157
Open

fix(sync): clear __pw_stack__ on task completion to prevent memory le…#3158
atiqur-rahman-pro wants to merge 1 commit into
microsoft:mainfrom
atiqur-rahman-pro:fix/sync-pw-stack-leak-3157

Conversation

@atiqur-rahman-pro

Copy link
Copy Markdown

Summary of Changes

In playwright/_impl/_sync_base.py, inspect.stack(0) is attached to task.__pw_stack__. Because live FrameInfo objects pin all caller local variables in memory, retaining the task causes a memory leak.

This PR updates task.add_done_callback to delete task.__pw_stack__ upon task completion, ensuring frame objects and local variables are garbage collected immediately.

Fixes #3157

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant