- Offizieller Beitrag
Ich konnte raus finden, dass leider einer unser Drittanbieter die wir für das Webseiten Element nutzen nicht alle Windows Handles richtig wieder freigibt. Je nachdem wie oft das Element bei euch gewechselt und wieder angezeigt wird beendet sich der Monitor vermutlich zwischen 24 Stunden und 14 Tagen. Beim Windows gibt es eine künstliche Grenze für Handles pro Prozess, diese liegt bei 10.000 gleichzeitigen Handles, diese sind in der Regel auch vollkommen ausreichend.
Wir haben Kunden, die Zeigen über dieses Element den Dienstplan relativ oft im Wechsel an. Hier kommt es teilweise schon innerhalb von 24 Stunden zu einem Absturz, je nachdem wie Windows mit den Handles intern umgeht. Um diese Zeit zu verlängern ist es möglich die Handles auf Windows in der Registry zu erhöhen.
Ihr macht die Anpassung auf eigenes Risiko! Dies ist eine sehr weitreichende und tiefgehende Veränderung an eurem Windows.
Alles anzeigenWhy it is Important to Dispose of GDI Objects
Unlike the majority of the objects in the .NET Framework, GDI handles are not automatically disposed when your application no longer holds a reference to them. This, as you may have already guessed, can lead to memory allocations that are never released. Over time (application up-time), this could lead to large consumption of memory usage and ultimately an "Out of Memory" exception.
There is however another consideration, which given the vast amounts of RAM computers use as standard, is probably going to be of greater concern - especially if you’re doing a fair amount of custom drawing.
Windows has a limit on the number of GDI handles that a session (i.e., application) is permitted to hold. This value is determined in the system registry, and by default, is set to 10,000 handles (at least this is the case in XP, Vista and 7). This value can be altered by those of you comfortable editing the registry but the maximum that can be applied is 65,536 (Windows 2000 is 16,384).
I would strongly advise you do not rely on this method, as in a production application it would be better to not change any system registry values on a customers machine. The last thing you want is to cause a customer's system problems. Either way, the following registry setting is the one of interest:
Hide Copy Code
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\GDIProcessHandleQuote
* WARNING *
Changing the wrong registry values can seriously damage the stability of your Windows system. Do so at your own risk.
Unter HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows findet ihr den Schlüssel GDIProcessHandleQuote, diesen könnt ihr mal testweise auf 20k oder 30k erhöhen und testen ob die Laufzeit für euch nun Akzeptabel ist. Maximal könnt ihr dort 65536 eintragen.