Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!pilchuck!dataio!bright
From: bright@Data-IO.COM (Walter Bright)
Newsgroups: comp.lang.c
Subject: Re: Memory Models
Keywords: Memory models,C
Message-ID: <2092@dataio.Data-IO.COM>
Date: 11 Aug 89 20:25:04 GMT
References: <562@dcscg1.UUCP> <1633@crdgw1.crd.ge.com>
Reply-To: bright@dataio.Data-IO.COM (Walter Bright)
Distribution: usa
Organization: Data I/O Corporation; Redmond, WA
Lines: 22

In article <1633@crdgw1.crd.ge.com> davidsen@crdos1.UUCP (bill davidsen) writes:
>  I'll provide some information, but bear in mind that [memory] models are a
>characteristic of the linker, rather than something just in C.

The linker has nothing to do with it. Memory model is determined by the
compiler (usually with a command line switch) and by which runtime library
is used. The linker doesn't know or care which memory model is used.

>  Two other models are tiny (code and data share the same segment) and
>huge, in which array and aggregate objects may be larger than 64k.

In some C compilers, the tiny model has code and data sharing the same
segment. In Zortech C, they *do not*. The limitation with Zortech's
tiny model is that (code size) + (static data size) < 64k. This means
that the amount of memory available for the stack and heap is
64k - (static data size) instead of 64k - (static data size) - (code size).

It's worth noting that the only difference between the tiny and small memory
models is a different startup object file is used.

P.S. I should know, I implemented the Zortech tiny model, after listening
to people tell me it couldn't be done.