Skip to content

fix: reuse Windows GUID type across calls#505

Closed
Sanjays2402 wants to merge 1 commit into
tox-dev:mainfrom
Sanjays2402:fix/reuse-windows-guid-type
Closed

fix: reuse Windows GUID type across calls#505
Sanjays2402 wants to merge 1 commit into
tox-dev:mainfrom
Sanjays2402:fix/reuse-windows-guid-type

Conversation

@Sanjays2402

Copy link
Copy Markdown

Fixes #501.

get_win_folder_via_ctypes() defined a new ctypes Structure on every lookup, so ctypes retained a new pointer type per call. This caches the lazily constructed GUID type and adds a regression test that verifies repeated lookups reuse it.

Tests: pytest -q (883 passed, 91 skipped); Ruff check and format on the changed files.

Repeated Windows folder lookups created a new ctypes Structure class, causing ctypes to retain a new pointer type per call. Cache the lazily constructed GUID type and cover its reuse with a regression test.
@gaborbernat

Copy link
Copy Markdown
Member

Superseeded by #507, thanks for opening this PR!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Memory leak caused by repeated calls

2 participants