Memory Models

Walter Bright bright at Data-IO.COM
Sat Aug 12 06:25:04 AEST 1989


In article <1633 at crdgw1.crd.ge.com> davidsen at 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.



More information about the Comp.lang.c mailing list