In this section we state the last axiom we need for our detailed model of the C++ virtual machine. This axiom addresses the time required to allocate and to free dynamically allocated storage:
Axiom The time required to allocate a fixed amount of storage from the heap using operator new is a constant, . This time does not include any time required for initialization of the storage. Similarly, the time required to return a fixed amount of storage to the heap using operator delete is a constant, . This time does not include any time spent cleaning up the storage before it is returned to the heap.
By applying Axioms and , we can determine that the running time of the statement
int* ptr = new int;is . Similarly, the running time of
delete ptr;is .