Memory models and memory allocation

Under UNIX, memory allocation isn't a problem. Under Windows, the only really viable way to go is to use the large model, which uses the global heap instead of the local heap for memory allocation. Unless more than one read-write data segment is used (see large data below), large model programs may still have multiple instances under MS C/C++ 7. Microsoft give the following guidelines for producing multiple-instance large model programs:

Even with the single-instance limitation, the productivity benefit is worth it in the majority of cases. Note that some other multi-platform class libraries also have this restriction. (If more than one instance really is required, create several copies of the program with different names.)

Having chosen the large model, just use C++ 'new', 'delete' (and if necessary 'malloc' and 'free') in the normal way. The only restrictions now encountered are a maximum of 64 KB for a single program segment and for a single data item, unless huge model is selected.