4.4 Customizing Memory Models

A third way to manage memory is to combine different features from standard memory models to create your own customized memory model. You should have a thorough understanding of C/C++ memory models and the architecture of 80x86 processors before creating your own nonstandard memory models.

Summary: In a customized model, you select the size of code pointers and data pointers.

The /Astring option lets you change the attributes of the standard memory models to create your own memory models. The three letters in string correspond to the code pointer size, the data pointer size, and the stack and data segment setup, respectively. Because the letter allowed in each field is unique to that field, you can give the letters in any order after /A. All three letters must be present.

The standard memory-model options (/AT, /AS, /AM, /AC, /AL, and /AH) can be specified in the /Astring form. As an example of how to construct memory models, the standard memory-model options are listed below with their /Astring equivalents:

Standard Custom Equivalent

/AT /Asnd
/AS /Asnd
/AM /Alnd
/AC /Asfd
/AL /Alfd
/AH /Alhd

For example, you might want to create a huge-compact model. This model would allow huge data items but only one code segment. The option for specifying this model would be /Ashd.

Note:

Tiny model is identical to small model except that it causes the linker to search for CRTCOM.LIB. The executable file generated when you specify tiny model is a .COM file rather than an .EXE.