CTypedPtrListmyList; CPerson* pPerson = new CPerson(); myList.AddHead(pPerson); POSITION pos = myList.GetHeadPosition(); while(pos != NULL) { delete myList.GetNext(pos); } myList.RemoveAll(); CArray myArray; int i = 0; while (i < myArray.GetSize()) { delete myArray.GetAt(i++); } myArray.RemoveAll(); CMap myMap; POSITION pos = myMap.GetStartPosition(); while(pos != NULL) { CPerson* pPerson; CString string; myMap.GetNextAssoc(pos, string, pPerson); delete pPerson; } myMap.RemoveAll();