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

[win32] HDC leak in Image.createGdipImage() #21

Closed
SyntevoAlex opened this issue Apr 6, 2022 · 3 comments · Fixed by #22
Closed

[win32] HDC leak in Image.createGdipImage() #21

SyntevoAlex opened this issue Apr 6, 2022 · 3 comments · Fixed by #22
Assignees
Labels
bug Something isn't working leak Memory leak issue
Milestone

Comments

@SyntevoAlex
Copy link
Member

Bug 493455 accidentally removed device.internal_dispose_GC(hDC, null) from Image.createGdipImage() on win32, which now leaks one HDC per image created. Note that GC.drawImage() may create the image internally.

As the leak grows, Windows get slower. When leak reaches 10000 (default maximum for one process), SWT will begin to throw SWT.error() and UI begins to malfunction.

I'll provide a patch.

@SyntevoAlex SyntevoAlex changed the title [win32] HDC leak (regression from Bug 493455) [win32] HDC leak in Image.createGdipImage() Apr 6, 2022
SyntevoAlex added a commit to syntevo/eclipse.platform.swt that referenced this issue Apr 6, 2022
Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
@SyntevoAlex
Copy link
Member Author

This is a serious regression. It makes entire Windows slower. Also, when leak reaches 10000, application either dies on SWT.ERROR_NO_HANDLES exception, or, if exceptions are consumed, UI gets completely broken - various parts will not be painted, buttons can't be pushed, and it's not even possible to close app without Task manager.

SyntevoAlex added a commit to syntevo/eclipse.platform.swt that referenced this issue Apr 6, 2022
This is a regression from recent Bug 493455, where this line was lost
during refactoring:
  device.internal_dispose_GC(hDC, null)

Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
tmssngr pushed a commit to syntevo/eclipse.platform.swt that referenced this issue Apr 6, 2022
This is a regression from recent Bug 493455, where this line was lost
during refactoring:
  device.internal_dispose_GC(hDC, null)

Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
iloveeclipse referenced this issue Apr 6, 2022
…Image""

This reverts commit 7c72227.

Reason for revert: Considering for 4.24 M1

Change-Id: I1a6fc26f96a0ccd82c7aa5994fa134f798e40ef4
Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/191861
Tested-by: Niraj Modi <niraj.modi@in.ibm.com>
Reviewed-by: Niraj Modi <niraj.modi@in.ibm.com>
@iloveeclipse
Copy link
Member

To be more precise, this was the change here:

22797d3#r70580523

Thanks Alex, I can reproduce & verified the fix is working.

iloveeclipse pushed a commit that referenced this issue Apr 6, 2022
This is a regression from recent Bug 493455, where this line was lost
during refactoring:
  device.internal_dispose_GC(hDC, null)

Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
@niraj-modi niraj-modi added the bug Something isn't working label Apr 6, 2022
@niraj-modi niraj-modi added this to the 4.24 M1 milestone Apr 6, 2022
@niraj-modi niraj-modi added the leak Memory leak issue label Apr 6, 2022
@niraj-modi
Copy link
Member

To be more precise, this was the change here:

22797d3#r70580523

Thanks Alex, I can reproduce & verified the fix is working.

Thanks Alexandr/Andrey, closing for 4.24 M1

SyntevoAlex added a commit to syntevo/eclipse.platform.swt that referenced this issue Apr 6, 2022
Fixes eclipse-platform#25
Regression from eclipse-platform#21

Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
SyntevoAlex added a commit to syntevo/eclipse.platform.swt that referenced this issue Apr 6, 2022
Fixes eclipse-platform#25
Regression from eclipse-platform#21

Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
iloveeclipse pushed a commit that referenced this issue Apr 7, 2022
Fixes #25
Regression from #21

Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
@niraj-modi niraj-modi linked a pull request Apr 18, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working leak Memory leak issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants