Hi, I have a small MFC app, i have two buttons, i have a dummy function too.
I have a small dll, the issue is when i press the button 2 I have memory leak (i have tried with CMemoryState and does not detect any memory leak, but i can see it in the Process Explorer).
In my simple dll code i have in the "stdafx.h" file the following line
#include <afxwin.h>,
but if i comment this line, the memory leak is gone.
I tried to comment all my dll code (except that include) and the problem still persists.
Any clues of this behavior?
(I tried in a Win32 application instead of MFC and i have the same problem)
Code:
void CPruebaThreadDlg::OnBnClickedButton1()
{
LPVOID lpParam = NULL;
AfxBeginThread(dummy, lpParam, THREAD_PRIORITY_NORMAL, 0, 0, NULL);
}
void CPruebaThreadDlg::OnBnClickedButton2()
{
int i;
HMODULE hmod = LoadLibrary("SimpleDll.dll");
while(true)
{
for(i = 0; i <= 150; i++)
OnBnClickedButton1();
Sleep(700);
}
}
UINT dummy(LPVOID)
{
return 0;
}