About CTypedPtrList class--"new" and "delete"..
-
The Problem is --Where and How to Delete the created objects with "new" Operator Please mark the palce and solution.. i tried with somany ways but i am getting "Heap assertion" and in Debugging mode it is showing MemoryLeak Detected as follows: Detected memory leaks! Dumping objects -> {172} normal block at 0x002F5F88, 500 bytes long. Data: 44 3A 5C 50 72 6F 6A 65 63 74 73 5C 44 75 6D 70 and also i am getting the First-chance exception in MyApp.exe (KERNEL32.DLL): 0x000006B5: (no name). please give me the solution I am very much worring about these problems please please.... This is Mycode: I am declaring structures as follows: 1.For Database entries: ;;;;;;;;;;;;;;;;;;;;;;; typedef struct{ char strName[MAX_PATH]; int nNumber; int nCode; }DB_DATA; 2:For Daily entries: ;;;;;;;;;;;;;;;;;;;; typedef struct{ char strName[MAX_PATH]; int nNumber; int nCode; }DAILY_DATA; Now i am using CTypedPtrList as follows: 1.For Database: =============== typedef CTypedPtrList DB_DATA_LIST; DB_DATA_LIST m_lstDbData; 2.For Initial List: ================== typedef CTypedPtrList INITIAL_LIST; INITIAL_LIST m_InitialList; 3.For Priority List: ==================== typedef CTypedPtrList PRIORITY_LIST; PRIORITY_LIST m_PriorityList; Initially i am getting all the data from database and store it in "m_lstDbData" as follows: ############ while (EndOfFile) { DB_DATA * dbdata=new DB_DATA; strcpy(dbdata->sName,rs.sName); dbdata->nNumber=rs.nNumber; dbdata->nCode=rs.nCode; m_lstDbData.AddTail(dbdata); MoveNext(); } Preparing the InitialList as follows: ````````````````````````````````````` Now i am checking the Dialy Register(one Text file contains record wise data) if Daily Register values mactched with Database values then stored this values into InitialList. do { POSITION nPos=m_lstDbData.GetHeadPosition(); for(int nPass=0;nPassnCode) { DAILY_DATA * tempDailyData=new DAILY_DATA; strcpy(tempDailyData->sFileName,str); tempDailyData->nNumber=tempDbdata->nNumber; tempDailyData->nCode=tempDbdata->nCode; InitialList.AddTail(tempDailyData); }//end if(Dial