Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

possible GDI Object leak on Windows #73

Open
carlfarrington opened this issue Dec 4, 2022 · 3 comments
Open

possible GDI Object leak on Windows #73

carlfarrington opened this issue Dec 4, 2022 · 3 comments

Comments

@carlfarrington
Copy link

Every time get_monitors() is called, the GDI Objects count for the python process on win32 increases.
Once the 10,000 GDI Object hard limit is reached, the desktop becomes lagged, and GUI things break (my script is managing an application's full-screen status, and the result is a corrupted / not-fully-repainted window).

A small test, if you add the GDI Objects column to taskmgr, you can see the count continually increase.

while True:
    for m in get_monitors():
        print(str(m))
@carlfarrington
Copy link
Author

This may relate to 'the call to ReleaseDC is incorrect'
https://github.com/rr-/screeninfo/issues/30#issuecomment-612631519

@rr-
Copy link
Owner

rr- commented Dec 5, 2022

@carlfarrington can you verify if this stalled pull request fixes the issue you're experiencing and doesn't break the functionality?
https://github.com/rr-/screeninfo/pull/32
Thanks

@IFD3
Copy link

IFD3 commented Apr 28, 2024

A shame this is still open. I had the same problem. Thousands of GDI Handles after some hours. Basically 1 Handle per get_monitors() ...
Well after replacing the "screeninfo\enumerators\windows.py" with the one from https://github.com/rr-/screeninfo/pull/32 I can comfirm this fixes the issue.

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

No branches or pull requests

3 participants