Click here to Skip to main content
15,918,808 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Hi... Great People.... Pin
Tareq Ahmed Siraj9-Mar-05 20:11
Tareq Ahmed Siraj9-Mar-05 20:11 
GeneralRe: Hi... Great People.... Pin
deldeep11-Mar-05 18:42
deldeep11-Mar-05 18:42 
GeneralReadDebuggeeMemory Pin
Aleksan9-Mar-05 19:16
Aleksan9-Mar-05 19:16 
Generalhelp needed SafeArrayAccessData Pin
arusmemon9-Mar-05 18:25
arusmemon9-Mar-05 18:25 
GeneralRe: help needed SafeArrayAccessData Pin
Tareq Ahmed Siraj9-Mar-05 19:40
Tareq Ahmed Siraj9-Mar-05 19:40 
QuestionHow to Transfer the image Captured using Screen Capture Code to other machine Pin
karmegakumar9-Mar-05 18:13
karmegakumar9-Mar-05 18:13 
AnswerRe: How to Transfer the image Captured using Screen Capture Code to other machine Pin
spinoza16-May-05 21:42
spinoza16-May-05 21:42 
GeneralMemory Problems with new, delete and CObArray Pin
NeoHobbit9-Mar-05 16:54
NeoHobbit9-Mar-05 16:54 
Hi. I am having problems with deleting objects from a CObArray not freeing up the memory.

NB: The code has been simplified to show only the key points.

In the header
class CBelFileDetails : public CObject
{
public:
 CBelFileDetails ()
 {
  // Fill variables
 };
 ~CBelFileDetails () {};

 //Bunch of variables of type CString, DWORD and BOOL
};

In the Implementation
void RemoveArray (CObArray *pA)
{
 int j, Count;
 Count =  pA -> GetSize ();
 for (j = 0; j < Count; j++)
 {
  CObject* P = pA -> GetAt (j);
  if (P)
  {
   TRY
   {
    delete P;
    P = NULL;
   }
   CATCH_ALL (e)
   {
    e->ReportError ();
   }
   END_CATCH_ALL
  }
 }
 pA -> RemoveAll ();
}

void CMainFrame::OnTimer(UINT nIDEvent) 
{
 int j;
 CObArray FileDetailsArray;
 for (j = 0; j < NumOfFiles; j++)
 {
   CBelFileDetails *pFD = new CBelFileDetails ();
   // Fill in values
   FileDetailsArray.Add (pFD);
 }
 RemoveArray (&FileDetailsArray);
}


The problem is, if I watch the 'Mem Usage' in TaskManager it forever goes up. As if the memory is not being released. I run it in debug mode, and same thing happens. But when I close the application, no memory leaks are reported.

I am wondering if any of you have encountered the same problem and if so, how did you fix it?
GeneralRe: Memory Problems with new, delete and CObArray Pin
Christian Graus9-Mar-05 17:05
protectorChristian Graus9-Mar-05 17:05 
GeneralRe: Memory Problems with new, delete and CObArray Pin
NeoHobbit9-Mar-05 17:14
NeoHobbit9-Mar-05 17:14 
GeneralGetOpenFileName in a service Pin
TheGreatAndPowerfulOz9-Mar-05 14:48
TheGreatAndPowerfulOz9-Mar-05 14:48 
GeneralRe: GetOpenFileName in a service Pin
TheGreatAndPowerfulOz9-Mar-05 14:52
TheGreatAndPowerfulOz9-Mar-05 14:52 
GeneralRe: GetOpenFileName in a service Pin
xxrl9-Mar-05 17:06
xxrl9-Mar-05 17:06 
GeneralRe: GetOpenFileName in a service Pin
Ryan Binns9-Mar-05 17:28
Ryan Binns9-Mar-05 17:28 
GeneralRe: GetOpenFileName in a service Pin
TheGreatAndPowerfulOz10-Mar-05 10:23
TheGreatAndPowerfulOz10-Mar-05 10:23 
Generalget exe path Pin
Marcus Spitzmiller9-Mar-05 14:07
Marcus Spitzmiller9-Mar-05 14:07 
GeneralRe: get exe path Pin
Christian Graus9-Mar-05 14:47
protectorChristian Graus9-Mar-05 14:47 
GeneralRe: get exe path Pin
Marcus Spitzmiller9-Mar-05 14:59
Marcus Spitzmiller9-Mar-05 14:59 
GeneralRe: get exe path Pin
gamitech9-Mar-05 21:13
gamitech9-Mar-05 21:13 
Generalmergesort Pin
Ylis9-Mar-05 9:24
Ylis9-Mar-05 9:24 
Generalhelp me!!! Pin
kookoorikoo9-Mar-05 9:06
kookoorikoo9-Mar-05 9:06 
GeneralRe: help me!!! Pin
Ylis9-Mar-05 9:27
Ylis9-Mar-05 9:27 
GeneralProblem with main MDI Frame window Pin
Anonymous9-Mar-05 8:56
Anonymous9-Mar-05 8:56 
GeneralRe: Problem with main MDI Frame window Pin
Ryan Binns9-Mar-05 17:30
Ryan Binns9-Mar-05 17:30 
GeneralInclude Help Needed Pin
Jeryth9-Mar-05 7:53
Jeryth9-Mar-05 7:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.