Board index » delphi » Data Segment too large

Data Segment too large

I am getting an error 'data segment too large' .  This is a fairly large
system with about 10 units.
Is there anything I can do?

Also, where do I see the size of the data segement of an exe file?

Is there a difference between the USES clauses of the interface and
implementation sections?

Thanks

 

Re:Data Segment too large


Your data segment in real mode PASCAL apps can't be larger than 64 KB.
What you can do, is use pointers for large data structures like big
arrays. But without knowing your variable declarations we won't be able
to help further.

Greetings

Markus

Re:Data Segment too large


"Akbar Ganey" <akb...@internext.co.za> schreef in bericht
news:ae7ns4$nr3$1@ctb-nnrp2.saix.net...

Quote
> I am getting an error 'data segment too large' .  This is a fairly
large
> system with about 10 units.
> Is there anything I can do?

As Markus said: try to use pointers. Especially for array's.
You can also try to limit the length of locally and globally defined
strings

e.g. if a string never contains more than 5 chars
var mystring: string[5];

 Also you can try

Type real=single;
Be careful since this will replace all the following real var definitions
with a 4 byte real instead of a 6 byte.

Quote
> Also, where do I see the size of the data segement of an exe file?

The amount of data segment used can be found after compiling the program
under
Compile/Information.

Quote
> Is there a difference between the USES clauses of the interface and
> implementation sections?

It is possible to make circular uses clauses where two units call each
other if you have them in the implementation. It is not advisable to do
so however.

Femme

Re:Data Segment too large


Quote
"Akbar Ganey" <akb...@internext.co.za> wrote in message news:ae7ns4$nr3$1@ctb-nnrp2.saix.net...
> I am getting an error 'data segment too large' .  This is a fairly large
> system with about 10 units.
> Is there anything I can do?

Minimize Global (or Interfaced) variables and typed constants everywhere.
if you must have interfaced or global strings, use a fixed size rather than
the generic string (256 bytes each).  Put big arrays on the heap and just
keep pointers to them.  Allocate and initialize them in the initialization section of the
unit, if desired.

Quote
> Also, where do I see the size of the data segement of an exe file?

There are utilities to display the header information of an exe file.  I don't know if
data segment size is specified.  Pascal will report the data segment size at the
end of compilation, IIRC.

Quote
> Is there a difference between the USES clauses of the interface and
> implementation sections?

The only time a unit needs to be mentioned in an interface section USES
statement is if something in the unit's interface requires something in the
other unit.  I've had problem with circular references when units are needless put
in the interface section USES.  Most modules are fine in the implementation section
USES.

Rufus

Other Threads