Ignacio Soler Garcia
Ignacio Soler Garcia

Reputation: 21855

Can GDI leaks from one process affect other processes?

we are having GDI resource leaks that cause from time to time "Win32Exception Not enough storage is available to process this command" (related question).

Our application is composed from a Word Addin and a C# application. Can a leak in the Word addin remove the resources from the C# application? We have seen the application crash after some unrelated Addin problems.

In other words, are GDI resources allocated exclusively per process or are they shared somehow?

Upvotes: 0

Views: 369

Answers (1)

Chris Chilvers
Chris Chilvers

Reputation: 6479

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?

Upvotes: 2

Related Questions