Dll components fail to initialize
-
Wednesday, May 11, 2005 3:46 AM
Ours is a multi-threaded application programmed in VC++ calling VB dll's.
On a Windows 2000 server (Dual Processor & 1GB RAM), about 40 instances of this application run without any problem. But the moment a few more are created (when the task manager is pulled up, the number of processes are about 120 - 40 by this application and reaching around 1250 threads in all), all the applications start throwing errors when creating dll components.
The very first error in each application is "Class not registered"
and the following errors are all "Not enough storage to complete this operation".
At this point the memory usage is almost 0%; there's lots of RAM and hard disk space available, so I am unable to understand the reason why "Not enough storage" comes up. Also, this seems to be closely related with the number of threads and the number of processes calling CreateDispatch or CreateInstance of the dll component. On another machine with lesser RAM and storage, a lot more application instances than the number for which the component creation fails, run without any problem.What could possibly be the cause? I am unable to tell if the error is hardware specific, operating system specific or program specific! Please Help. I have been breaking my head for about a week now.
All Replies
-
Wednesday, May 11, 2005 6:02 AM
You're probably exhausting the desktop heap. One way this manifests itself is by RegisterClass failing - which in turn leads to "Class not registered". Can you reduce the number of window classes and/or combine some of the processes to reduce their total number? Right now you're registering 120 * N classes (where N is the number of classes registered by each copy of the program). Reducing 120 or N will relieve the pressure on the desktop heap. Thread count is not relevant here. 1250 threads sounds excessive at any rate; your system is probably thrashing the scheduler. Can you switch to a thread pool?

