一個進程的 GDI 洩漏會影響其他進程嗎? (Can GDI leaks from one process affect other processes?)


問題描述

一個進程的 GDI 洩漏會影響其他進程嗎? (Can GDI leaks from one process affect other processes?)

我們遇到 GDI 資源洩漏,不時會導致“Win32Exception 沒有足夠的存儲空間來處理此命令”(相關問題)。

我們的應用程序由 Word Addin 和 C# 應用程序組成。Word 插件中的洩漏是否可以從 C# 應用程序中刪除資源?在一些不相關的插件問題之後,我們已經看到應用程序崩潰。

換句話說,GDI 資源是按進程獨占分配還是以某種方式共享?


參考解法

方法 1:

The exact number can depend on the version of windows but is generally a theoretical limit of 65,536 per session. In reality this is lower (e.g. 16,384 in Windows 2000).

There is also a per process limit of about 10,000 handles though this can be globally changed via the registry setting HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\GDIProcessHandleQuota. Though this setting shouldn't be changed by an application since its a global setting for the computer.

MSDN ‑ GDI Objects

Old New Thing ‑ Why is the limit of window handles per process 10,000?

(by Ignacio Soler GarciaChris Chilvers)

參考文件

  1. Can GDI leaks from one process affect other processes? (CC BY‑SA 2.5/3.0/4.0)

#gdi #resource-leak #.net #gdi+ #C#






相關問題

繪製鼠標光標 (Draw mouse cursor)

C 和 Windows GDI 中的雙緩衝 *framework* (Double-buffering *framework* in C and Windows GDI)

一個進程的 GDI 洩漏會影響其他進程嗎? (Can GDI leaks from one process affect other processes?)

BeginPath Textout EndPath 繪製反轉文本 (BeginPath Textout EndPath draws inverted text)

監控GDI通話 (Monitoring GDI calls)

如何捕獲(並希望修復)GDI 資源洩漏 (How to catch (and hopefully fix) a GDI resource leak)

如何使用 GDI(+) 在內存中渲染漸變 (How to render a gradient in memory using GDI(+))

使用 BITMAP::bmBits 與 GetDIBits 有什麼區別? (What is the difference between using BITMAP::bmBits vs GetDIBits?)

獲取背景窗口的縮略圖 (Get Thumbnail of background window)

AlphaBlend 返回“假”的原因可能是什麼 (What could be the reason for AlphaBlend to return 'false')

在 C++ 中查找像素 RGB 數據的最快方法是什麼? (What is the fastest method to lookup pixel RGB data in C++?)

逐行讀取文本框並將其視為單獨的文本 (Read a textbox line by line and treat it as a separate text)







留言討論