NEWOPR: Demonstrates the C++ new Operator in Large Model

NEWOPR is a simple application that demonstrates some of
the issues presented in the "Allocating Memory the
Newfangled Way: The new Operator" technical article on the
Microsoft(R) Developer Network CD.

NEWOPR tries to allocate 128 blocks of memory, 1024 bytes
per block. When NEWOPR is compiled as a medium-model
program, it cannot allocate 128 blocks because it runs out
of memory in the default data segment. In fact, the
Microsoft Foundation Class library raises an exception
when the new operator fails, and NEWOPR handles this
exception gracefully.

When NEWOPR is compiled as a large-model program, it can
allocate all 128 blocks because the memory is allocated
from the global heap instead of the local heap.

The best way to use NEWOPR is to compile it medium model,
run it, and examine the heap with Heap Walker. Run NMAKE
with the CLEAN option, and then compile large model. Run
the large-model version, and re-examine the heap with Heap
Walker.

The following parameters control how NEWOPR gets built:

>  DEBUG=[0|1]: Setting of 1 enables debugging
information.

>  LARGE=[0|1]: Setting of 1 compiles NEWOPR as a large-
model program.

>  MINST=[0|1]: Setting of 1 compiles with /Gt and /Gx
options to allow multiple instances. LARGE must be set to
1.

>  CLEAN: Deletes .EXE, .RES, and .OBJ files.

Sample NMAKE command lines are shown below:

>  nmake:  Makes medium-model version.

>  nmake DEBUG=1:  Makes medium-model debug version.

>  nmake LARGE=1:  Makes large-model version.

>  nmake MINST=1:  Makes medium-model version. MINST is
ignored.

>  nmake LARGE=1 MINST=1:  Makes multi-instance, large-
model version. MFC large-model library must be compiled
with /Gx and /Gt for this to work.

>  nmake DEBUG=1 LARGE=1 MINST=1:  Same as above, but
enables debugging.

NewOpr was built and tested under Microsoft(R) Windows(TM)
version 3.1.

KEYWORDS: PR-CD2; LoadAccelTable; new operator
