Reputation: 225
I am having one Delphi XE2 project to handle large numbers of calculations.
In my project i am having total 1290 Numbers of Edit
, 340 Numbers of Label
, 330 Numbers of Panel
, 16 Numbers of TabSheet
. For each and every Edit
, there is OnChange
, OnDblClick
, OnEnter
and OnExit
events.
I have to handle total 1034 Numbers of Variable
. I have just designed the Form
and not added those calculation logic. Now my .pas file
becomes 62.5MB
having 1815057 Lines and .dfm file
becomes 1.98 MB
having 65540 Lines.
I am trying to compile the project using Delphi XE2
under Windows XP Professional SP3 32Bit
, but I am getting error as **[DCC Fatal Error] Unit1.pas(1815058): F2046 Out of memory**
.
I have also tried to compile it using Delphi XE5
under Windows 8 Enterprise 64Bit
, here is also, I am getting the same problem.
I have not added the complete calculation logic using 1034 Numbers of variables, if I add them , at least 4200 Lines will be added to the .pas file
.
Upvotes: 2
Views: 21670
Reputation: 612874
Your entire approach is flawed. The compiler simply cannot handle the size of file that you present it. A 1.8 million line pascal source file is ridiculous. A 2MB .dfm file is impractical.
It appears that you have coded all possible options as separate controls and variables. You've not written the code by hand, but have done so using a pre-processing step, in Excel.
The solution is not to expand all the options at compile time. The solution is to write the application so that it can present the different options at run time. So, where you have 30 different variables, you've probably created 30 different label controls, and 30 different edit controls. The correct approach is to create one label and one edit control. Then at run time, depending on the user's option, change the caption of the label, and the content of the edit control.
Don't create one variable for every possible value that you need to store. Use arrays and or dictionaries.
At a high level, you need to take the logic that is contained in your Excel pre-processing step and convert it into run time Delphi code.
Upvotes: 17