15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


ThreadLocalStorage & MFC DLL

Murphy Lam -- Murphy_Lam@ccm.sc.intel.com
Monday, October 21, 1996

Environment: Window NT 4.0, Windows 95, VC++ 4.2

I have an application that loads a bunch of DLLs, each of which performs 
a unique processing function.  Both the application and the DLLs are 
written in MFC (and the DLLs are written as regular DLL).  I ran into a 
problem when trying to load more than 29 DLLs.  It ran out of Thread 
Local Storage slots (64 per process on both NT and 95) when trying to 
load the 30th DLL.  Upon further investigation, it looks like each DLL 
is using up two of these precious TLS slots for MFC's internal 
housekeeping.  And the number quickly added up to 64.

Is there a way to get around MFC so no (or less) TLS slot is used by 
these DLLs?  I do have a need to load that many DLLs.

-- Murphy



Mike Blaszczak -- mikeblas@nwlink.com
Wednesday, October 23, 1996

At 14:04 10/21/96 PDT, Murphy Lam  wrote:
>Environment: Window NT 4.0, Windows 95, VC++ 4.2

>Upon further investigation, it looks like each DLL 
>is using up two of these precious TLS slots for MFC's internal 
>housekeeping.  And the number quickly added up to 64.

Actually, MFC only uses one.  The C runtimes use another.

This issue is well-documented in the knowledgebase.

>Is there a way to get around MFC so no (or less) TLS slot is used by 
>these DLLs? 

Other than avoiding the shared MFC DLL builds, no, there isn't.

.B ekiM
http://www.nwlink.com/~mikeblas/
I'm afraid I've become some sort of speed freak.
These words are my own. I do not speak on behalf of Microsoft.





| Вернуться в корень Архива |