Large amounts of global data

Under Windows, it is possible that the default data segment becomes too large (for example, a large number of small, global data items have been declared). This may be cured by using more than one data segment. In Microsoft C++, specify the /Gt compiler option with a number representing the data size threshold for putting data items in a separate segment. For example, /Gt8.

The tradeoff is that using more than one data segment prevents you from having more than one instance of the program running at a time (see Memory Models). Large model programs with one data segment may still have multiple instances.

A separate problem sometimes occurs when the linker complains about too many segments. This can be cured by using the /SEG linker switch, for example /SEG:256.