Sunday, September 23, 2007

Windows 98 kernel is not NT kernel. There are limitations on the application resource (*.RES) size and EXE file size.
Application Resource Size
If you encounter:

"There is not enough free momory to run this program. Quit one or more programs, and then try again" OR

"There is not enough memory to start "MyApp.EXE". Quit some programs, and then try again.

But you are very sure you have more than enough memory to run the application. This is most probably you have too much resource items in the application. In Delphi application, the resource items could be DFM form, cursor, resource string and etc. From the test I did, the maximum number of resource items is 1035.
The size of resource doesn't cause any problem in my test. I have try to put a 10-20 mega bytes resource in the application and it still run well in windows 98. However, if you have more than 1035 resource items even each item has size of 1 byte, you will encounter the error as well.
Application File Size
If you encounter:

"A device attached to the system is not functioning" OR

The MyApp.EXE is linked to missing export MyPackage.BPL:@MyUnit@TMyClass@...

This error occurs on Delphi application compiled with runtime packages (.BPL). It is most probably the runtime package size is too big for Windows 98 to handle.
From the test I did, if my runtime package file size beyond 7-8 M, I will most probably encounter the error. Unfortunately, I have no actual figure on it.
To solve the problem, try split the runtime packages to smaller size. The error message prompted will display the package, pascal unit and class that cause the problem. You can use this information to check where you should start split the package. I guess this human readable information will available only if you compile the packages with debug symbol.