Simple arrays can be simply deleted. Certain arrays of pointers may require calling a member function to delete the objects pointed to.
If an array consists of T or R type elements, it can be destroyed by simply deleting it:
delete array;
Where the array is either a CArrayPtrFlat or CArrayPtrSeg object and the elements are pointers to CBase derived objects, then these objects should first be destroyed by calling the ResetAndDestroy() member function:
array->ResetAndDestroy(); delete array;
The RArray<class T> and RPointerArray<class T> types are normally allocated on the program stack and are not deleted. However, their array buffers are allocated on the heap and it is important that these arrays are handled correctly to avoid memory leaks.
As a minimum, their Close() functions must be called before the arrays go out of scope. Additionally, for the RPointerArray<class T> type, the ResetAndDestroy() function may be called if the objects represented by the array need to be deleted before the array goes out of scope.