Link to home
Start Free TrialLog in
Avatar of stkash
stkash

asked on

resource leak in CreateSolidBrush

What is wrong with this code?

CodeSnitch of Entrek (utility that allows profiling WinCE) emphasise the line with CreateSolidBrush as a resourse leak.

Assuming that in my test application there is no use of the m_Brush, this leak is really weird.

Can you explane it?

CPOEApp::CPOEApp(LPCTSTR lpszAppName): CWinApp(lpszAppName)

{

    m_Brush.CreateSolidBrush(TOP_LABEL_COLOR); //resource leak

}

CPOEApp::~CPOEApp()

{

    m_Brush.DeleteObject();

}

Stas K
ASKER CERTIFIED SOLUTION
Avatar of AlexFM
AlexFM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of martynjpearson
martynjpearson

Are you getting a memory leak too? It could be that the object that contains the brush is not being deleted, hence you would get a resource leak.

All the best
Martyn
Avatar of stkash

ASKER

no, I get only the resource leak