Board index » delphi » D1: "Data segment too large"

D1: "Data segment too large"

In Delphi 1 I get "Data segment too large" at compile-time.

I cannot see where I am allocating large amounts of space in this
segment. Could someone suggest places in my units where I could look for
the items that are contributing to the data segment.

Thanks in advance, and I'd appreciate if you could copy any replies to
my e-mail address.

 

Re:D1: "Data segment too large"


Quote
Bill Bell wrote:

> In Delphi 1 I get "Data segment too large" at compile-time.

> I cannot see where I am allocating large amounts of space in this
> segment. Could someone suggest places in my units where I could look for
> the items that are contributing to the data segment.

It's probably not the allocation of large amounts of space (dynamic
allocation comes from the heap, not the data segment. static allocation,
like a const array of 1000 LongInts, might be a problem), but just the
amount of code in that segment. You have only a 16-bit segment := 64K of
space to play with in each unit.

I have a unit that teeters on the limits of a data segment, and it's
about 5000 lines long. Does that come close to your situation?

The solution is to start moving code to another unit. Move all non-class
procedures and functions to a new unit. They will become far calls, and
thus be slower, but it's a minimal impact, and it's still infinitely
faster than your current setup, which doesn't compile at all.

Let me know if you have any problems. Good luck.

Dave

Re:D1: "Data segment too large"


Quote
In article <6bt3ta$cv...@wolf.interlynx.net> wb...@innovus.com (Bill Bell) writes:
>In Delphi 1 I get "Data segment too large" at compile-time.
>I cannot see where I am allocating large amounts of space in this
>segment. Could someone suggest places in my units where I could look for
>the items that are contributing to the data segment.

Look in the MAP file with full details turned on.

In Delphi-1, initialized constants consume space in the data segment and are a
frequent "hidden" cause of data-segment problems.

"Strings," which consume 256 bytes apiece, also burn up data-segment space
like goofy.  (Switching these, if constants, to "Pchars" can save a lot of
room.)

Other Threads