Alexander Zavalishin mentioned this to All:
AZ> Of course I can reduce data size by moving typed constants to
AZ> resource files, I probably MUST do it.
Without knowing any details of your application, it's hard to say how to fix
it. If you are indeed running out of data space, then consider these ideas:
- In an object-oriented environment such as Delphi, there is really not a lot
of reasons to have a large number of items in the global data space. You
just shouldn't have that many global variables. If you do, then you need to
rethink your design. Try putting all your globals into a class. Classes are
allocated from the heap. Encapsulate more or your data into new or existing
classes.
- If you have a lot of forms and you are creating instances of them at
run-time, you may not need to use global variables for them. If you are
auto-creating all your forms, consider creating them in code and deleting the
global variables for them. Of course, these variables, being class
instances, are really pointers and don't take up all that much room.
- If you have a lot of string constants and literals, put them into a
resource file and load them as needed with LoadStr.
- Large constant datasets should be read in as needed, either from a resource
file or from some other type of file.
AZ> But what if I'll get to the same
AZ> limit after making my project more complicated?
Actually, the project will be smaller and simpler. It will just take more
work to convert it.
AZ> What is wrong? I am using Delphi I, will an upgrade to II or III
AZ> do any good?
You will probably be able to squeeze more room into your data space by
converting to a 32-bit program, but it would be a patch, not a cure. Your
program would still eat a lot of valuable memory.
...Gary
--- GoldED 2.41
---------------
* Origin: The Flying Circus BBS, Farmington Hills, MI. (1:2410/905)
|