fedyamaslov1987 / inno-download-plugin

Automatically exported from code.google.com/p/inno-download-plugin
zlib License
0 stars 0 forks source link

IDP suffers from a 'GDI leak' #7

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
First of all thanks for the excellent work on the IDP. However I think I have 
discovered a resources leak as described below:

When using the download with UI (i.e. idpDownloadafter() which creates a custom 
wizardpage) it is observed that the number of GDI objects that is allocated by 
the setup.tmp *32 process keeps increasing by approx 3..4 objects per second. 
The OS typically limits the number of GDI objects for a single process to 10000 
(can be set in the registry). Consequently the download process will exceed 
this number after a download period of 41..55 minutes. This results in an 
EOutOfMemory exception raised by setup and the setup UI will no longer be 
updated. An 'Error creating window device context.' exception message is logged 
into INNO log file.

What steps will reproduce the problem?
1. Use example 1 from IDP distribution and ensure that you have a http server 
running on localhost.
2. Limit the bandwidth to the server to e.g. 5 kB/s (by using a tool such as 
NetLimiter). This will ensure you have a long download time even with small 
files.
3. Compile in INNO setup and run setup.
4. Use TaskManager or another tool such as ProcExplorer to view the number of 
allocated GDI objects per process. 
5. Complete the setup wizard and watch the number of allocated GDI objects 
slowly increasing while setup is downloading.

What is the expected output? What do you see instead?
The problem is that with large downloads and/or slow connection to the server, 
the setup wizard appears to hang after approx 40..50 minutes. Actually the 
download continues however the UI is no longer updated. This period can be 
longer if the connection to the server is extremely slow (e.g. limited to 1 
kB/s), in that case the update rate of the graphical objects on the custom 
wizard page is lower and also the number of leaked GDI objects per second is 
lower.

What version of the product are you using? On what operating system?
IDP v1.5.0
Inno setup compiler v5.5.5
Win 7 64 bit

Please provide any additional information below.

Original issue reported on code.google.com by gerald.v...@duran-audio.com on 19 Mar 2015 at 8:57

GoogleCodeExporter commented 8 years ago
The leak occurs here:
void Ui::rightAlignLabel(HWND label, tstring text)

calling ReleaseDC solves the problem

Original comment by CC.Red.A...@googlemail.com on 15 Apr 2015 at 10:28