12.7 Frame Variables and Exceptions

Explicitly allocated heap objects must also be deallocated before an exception is thrown. With frame objects, the frame memory will be reclaimed automatically by the exception mechanism. Although the memory occupied by the frame object is reclaimed, the destructor for the frame object is not executed by the exception mechanism.

For most objects the reclamation of frame space is sufficient to clean up the object, but for objects that allocate memory in addition to the frame space that they occupy, such as CString objects, the default exception handling is not sufficient to completely deallocate the object. In addition, objects whose destructors are an integral part of their operations need special handling during exceptions.