[comp.sys.mac] 32K limit

brun@husc4.HARVARD.EDU (todd brun) (01/08/88)

I've dabbled a bit in programming with Lightspeed Pascal, and have run across
an annoying, if not crippling problem.  After I program for a while, the 'GO'
option from the menu no longer will run the program; it states 'Program segment
longer than 32K' or something like that (I haven't got it right in front of
me).  Needless to say, this is crippling.  My program sufferes from errors of
a bizarre nature, but debugging is impossible.  Perhaps the 32K limit is itself
the error.  I don't know, but I understand that this is not exactly an
unknown problem.  I am working on a 512KE macintosh.  First of all, is there
any simple way to avoid this problem?  Second of all, exactly what is it that
is greater than 32K (not the code itself, certainly), and how does one correct
this?  Any advice and personal experiences are not only welcome but actively
solicited.  Please reply by e-mail, as I don't read this group all that often.
My health and sanity depends on your aid!  And some nice public domain programs
may well result...

Thanks a bunch.
Todd
--------------------------------------------------------------------------
disclaimer:  "Remember, guns don't kill people, bullets do."

han@apple.UUCP (-- Byron B. Han --) (01/09/88)

In article <3737@husc6.harvard.edu> you write:
>I've dabbled a bit in programming with Lightspeed Pascal, and have run across
>an annoying, if not crippling problem.  After I program for a while, the 'GO'
>option from the menu no longer will run the program; it states 'Program segment
>longer than 32K' or something like that (I haven't got it right in front of
>me).
 
You need to segment your application - each code segment has a maximum size
of 32K for most development environments.  MPW allows the developer to override
the limit.
 
Segmentation on Lightspeed Pascal is achieved by selecting view by segment
by clicking in the upper right hand corner of the project window and then
dragging source files from one segment to another.
 
Note that with LSP your segmentation is performed at the source file level.
With MPW the segmentation is performed at the procedure level.
 
With segmentation, your application can be HUGE.  Details on segmentation
can be found in the Lightspeed Pascal manual (as in how to segment your
project).  Also details can be found in Inside Macintosh, or Knaster's books
to name two sources off the top of my head.
 
This is not be construed as any position on Lightspeed Pascal.  This is not
an advertisement for MPW.

-- 
Byron Han, Communications Tool                              Apple Computer, Inc.
--------------------------------------------------------------------------------
CSNet: han@apple.COM     UUCP: {sun,voder,nsc,decwrl}!apple!han     408-973-6450
                 "Without Macintoshes, life itself would be impossible." - anon.

beto@CS.UCLA.EDU (01/09/88)

To: ucla-cs!zen!ucbvax!hplabs!pyramid!voder!apple!han
Subject: Re: 32K limit
Newsgroups: comp.sys.mac
In-Reply-To: <7149@apple.UUCP>
References: <3737@husc6.harvard.edu>
Organization: UCLA Computer Science Department
Cc: 
Bcc: 


I am having a problem with lightspeed C with data area bigger than 32k.
I tried to allocate memory using malloc() but  apparently I am 
messing up the heap.

the program looks like:

#define size 32000
int *x;
int i;
char *malloc();

x = (int *) malloc(sizeof(int)*size);
for (i = 0; i < size ; i++) 
  x[i] = 0 ;

Can anyone out there give me any advise on this problem?
Thanks in advance

Alberto Avritzer
Computer Science Dep.
Ucla