Which destructor is called when in C++?

Posted by BastiBechtold on Stack Overflow See other posts from Stack Overflow or by BastiBechtold
Published on 2010-12-22T10:46:17Z Indexed on 2010/12/22 10:54 UTC
Read the original article Hit count: 169

Filed under:
|

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();
    ...
}

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?

© Stack Overflow or respective owner

Related posts about c++

Related posts about destructor