Board index » delphi » Getting Error: Data Segment Too Large

Getting Error: Data Segment Too Large

I am using Delphi 1, working on converting an old dBASE program to
Delphi.  After developing module after module, I have many of them
working.  Now I am starting to get this error Data Segment Too Large.

How do I solve this problem?  It seems to indicate that all of the
data that I declare in the modules is stored in a large segment.  I
thought that after each module was called and then exited that space
was returned to the program.  But this seems to indicate that the
space is reserved "up front" at compile time for all of the modules.

Here is the first part the DPR for this program:

program Sps;

uses
  Forms,
  Spsopen in 'SPSOPEN.PAS' {spsstart},
  Spsabout in 'SPSABOUT.PAS' {AboutBox},
  Stchreg in 'STCHREG.PAS' {TchReg},
  Sstureg in 'SSTUREG.PAS' {StuReg},
  Stchrept in 'STCHREPT.PAS' {TchRept},
  Sgrmschd in 'SGRMSCHD.PAS' {GRmSchd},
  Stextbk in 'STEXTBK.PAS' {TextBk},
  Stchcoor in 'STCHCOOR.PAS' {TchCoord},
  Stcheval in 'STCHEVAL.PAS' {TchEval},
  Sstulabl in 'SSTULABL.PAS' {StuLabel},
  Slprint in 'SLPRINT.PAS' {SLabPrnt},
  Sstuattd in 'SSTUATTD.PAS' {StuAttend},
  Ssturolo in 'SSTUROLO.PAS' {StuRolo},
  Namerang in 'NAMERANG.PAS' {StuRang1},
  Stchrolo in 'STCHROLO.PAS' {TchRolo},
  Stchrng1 in 'STCHRNG1.PAS' {TchRang1},
  Stchlabl in 'STCHLABL.PAS' {TchLabel},
  Birthlis in 'BIRTHLIS.PAS' {Birthday},
  Scprint in 'SCPRINT.PAS' {SCrdPrnt},
  Srprint in 'SRPRINT.PAS' {SRolPrnt},
  Trprint in 'TRPRINT.PAS' {TRolPrnt},
  Tgprint in 'TGPRINT.PAS' {TSchdGRM},
  Sstualph in 'SSTUALPH.PAS' {StuAlph},
  Saprint in 'SAPRINT.PAS' {SAlphPrt},
  Ssturoom in 'SSTUROOM.PAS' {StuRoom},
  Uindex in 'UINDEX.PAS' {UtilIndex},
  Stchexp in 'STCHEXP.PAS' {TchExp},
  Sregform in 'SREGFORM.PAS' {RegForm},
  Sfprint in 'SFPRINT.PAS' {SFrmPrnt},
  Namerng2 in 'NAMERNG2.PAS' {StuRang2},
  Srmname in 'SRMNAME.PAS' {RmByName},
  Srmsex in 'SRMSEX.PAS' {RmBySex},
  Sstudir in 'SSTUDIR.PAS' {StuDir},
  Stuiacct in 'STUIACCT.PAS' {TuAcct},
  Studaily in 'STUDAILY.PAS' {TuDaily},
  Sacctbal in 'SACCTBAL.PAS' {TuBalance},
  Stupay in 'STUPAY.PAS' {TuPayment},
  Stuchrg in 'STUCHRG.PAS' {TuCharge},
  Tlprint in 'TLPRINT.PAS' {TLabPrnt},
  Userinfo in 'USERINFO.PAS' {UserForm},
  Setinfo in 'SETINFO.PAS' {SchlInfoDlg},
  Teprint in 'TEPRINT.PAS' {TEvlPrnt},
  Sbprint in 'SBPRINT.PAS' {SBrthPrnt},
  Stchprof in 'STCHPROF.PAS' {TchProf},
  Stchrng2 in 'STCHRNG2.PAS' {TchRang2},
  Tpprint in 'TPPRINT.PAS' {TProPrnt},
  Sstuqury in 'SSTUQURY.PAS' {SQuery};
{$R *.RES}

Any help is appreciated.
Thanks,
Bill Wester
US Census

 

Re:Getting Error: Data Segment Too Large


In article <3575383e.60449...@internet.census.gov>

Quote
William.C.Wes...@ccMail.Census.Gov (William Wester) wrote:
> I am using Delphi 1, working on converting an old dBASE program to
> Delphi.  After developing module after module, I have many of them
> working.  Now I am starting to get this error Data Segment Too Large.

> How do I solve this problem?  

Use dynamic variables (especially for "large" (i.e., > 2kb) structures),
or move to D2 or D3.

Best regards, The Chief
--------
Dr. A{*word*73}la A. Olowofoyeku (The African Chief)
Email: la...@keele.ac.uk
Homepage: http://ourworld.compuserve.com/homepages/African_Chief/
Author of: Chief's Installer Pro v4.25 for Win16 and Win32:
ftp://ftp.demon.co.uk/pub/ibmpc/win3/apps/chief/pro/chief425.zip

Re:Getting Error: Data Segment Too Large


William,

This means that you've either got too much stuff in one unit, or
that you've used way too many global-type variables. Try using
local variables (defined inside a procedure/function) as much
as possible. You might also try moving string constants (error
messages, etc.) to a STRINGTABLE resource and loading them
dynamically; this removes them from the data segment entirely,
and can free up considerable space.

HTH

Ken
--
Ken White
kwh...@westelcom.com

Clipper Functions for Delphi
http://members.aol.com/clipfunc/

Quote
William Wester wrote:

> I am using Delphi 1, working on converting an old dBASE program to
> Delphi.  After developing module after module, I have many of them
> working.  Now I am starting to get this error Data Segment Too Large.

> How do I solve this problem?  It seems to indicate that all of the
> data that I declare in the modules is stored in a large segment.  I
> thought that after each module was called and then exited that space
> was returned to the program.  But this seems to indicate that the
> space is reserved "up front" at compile time for all of the modules.

> Here is the first part the DPR for this program:

> program Sps;

> uses
>   Forms,
>   Spsopen in 'SPSOPEN.PAS' {spsstart},
>   Spsabout in 'SPSABOUT.PAS' {AboutBox},
>   Stchreg in 'STCHREG.PAS' {TchReg},
>   Sstureg in 'SSTUREG.PAS' {StuReg},
>   Stchrept in 'STCHREPT.PAS' {TchRept},
>   Sgrmschd in 'SGRMSCHD.PAS' {GRmSchd},
>   Stextbk in 'STEXTBK.PAS' {TextBk},
>   Stchcoor in 'STCHCOOR.PAS' {TchCoord},
>   Stcheval in 'STCHEVAL.PAS' {TchEval},
>   Sstulabl in 'SSTULABL.PAS' {StuLabel},
>   Slprint in 'SLPRINT.PAS' {SLabPrnt},
>   Sstuattd in 'SSTUATTD.PAS' {StuAttend},
>   Ssturolo in 'SSTUROLO.PAS' {StuRolo},
>   Namerang in 'NAMERANG.PAS' {StuRang1},
>   Stchrolo in 'STCHROLO.PAS' {TchRolo},
>   Stchrng1 in 'STCHRNG1.PAS' {TchRang1},
>   Stchlabl in 'STCHLABL.PAS' {TchLabel},
>   Birthlis in 'BIRTHLIS.PAS' {Birthday},
>   Scprint in 'SCPRINT.PAS' {SCrdPrnt},
>   Srprint in 'SRPRINT.PAS' {SRolPrnt},
>   Trprint in 'TRPRINT.PAS' {TRolPrnt},
>   Tgprint in 'TGPRINT.PAS' {TSchdGRM},
>   Sstualph in 'SSTUALPH.PAS' {StuAlph},
>   Saprint in 'SAPRINT.PAS' {SAlphPrt},
>   Ssturoom in 'SSTUROOM.PAS' {StuRoom},
>   Uindex in 'UINDEX.PAS' {UtilIndex},
>   Stchexp in 'STCHEXP.PAS' {TchExp},
>   Sregform in 'SREGFORM.PAS' {RegForm},
>   Sfprint in 'SFPRINT.PAS' {SFrmPrnt},
>   Namerng2 in 'NAMERNG2.PAS' {StuRang2},
>   Srmname in 'SRMNAME.PAS' {RmByName},
>   Srmsex in 'SRMSEX.PAS' {RmBySex},
>   Sstudir in 'SSTUDIR.PAS' {StuDir},
>   Stuiacct in 'STUIACCT.PAS' {TuAcct},
>   Studaily in 'STUDAILY.PAS' {TuDaily},
>   Sacctbal in 'SACCTBAL.PAS' {TuBalance},
>   Stupay in 'STUPAY.PAS' {TuPayment},
>   Stuchrg in 'STUCHRG.PAS' {TuCharge},
>   Tlprint in 'TLPRINT.PAS' {TLabPrnt},
>   Userinfo in 'USERINFO.PAS' {UserForm},
>   Setinfo in 'SETINFO.PAS' {SchlInfoDlg},
>   Teprint in 'TEPRINT.PAS' {TEvlPrnt},
>   Sbprint in 'SBPRINT.PAS' {SBrthPrnt},
>   Stchprof in 'STCHPROF.PAS' {TchProf},
>   Stchrng2 in 'STCHRNG2.PAS' {TchRang2},
>   Tpprint in 'TPPRINT.PAS' {TProPrnt},
>   Sstuqury in 'SSTUQURY.PAS' {SQuery};
> {$R *.RES}

> Any help is appreciated.
> Thanks,
> Bill Wester
> US Census

Other Threads