I am hunting memory leaks in a program.
I narrowed it down to some destructors not being called. However, I can't figure out why:
class CMain : public CList {
public:
CMain();
virtual ~CMain();
...
}
class CList : public CProc {
public:
CList();
virtual ~CList();
...
}
/* some code and a main func here */
CMain *pMain = new CMain();
/* some more code here */
delete pMain;
CMain
gets deallocated just fine, but ~CList()
is never called. All parent classes of CList
have virtual destructors, too.
Do you have any hints about why the destructor for CList
is never called?