Dear All,
I have a piece of code that loads an html page (using LoadFromResource) on
to the dialog as a GUI. Every time after the user does something then a
different html page will be loaded.
After I ran my code for a few thousand transactions then I see a big
increase in the memory size of my application.
I used Rational Purify and it said that mshtml.dll is leaking memory.
MLK: Memory leak of 10240 bytes from 5 blocks allocated in mshtml.dll
Distribution of leaked blocks
10240 bytes from 5 blocks of 2048 bytes (first block:
0x09f493d8)
Allocation location
[KERNEL32.dll ip=0x6C8033C8]
[mshtml.dll ip=0x7CCD284A]
[mshtml.dll ip=0x7CD3FABC]
[mshtml.dll ip=0x7CD3FA85]
[mshtml.dll ip=0x7CD3FBE8]
[mshtml.dll ip=0x7CD3FBAA]
[mshtml.dll ip=0x7CD3FAE2]
[mshtml.dll ip=0x7CCF110F]
[mshtml.dll ip=0x7CCF0FF2]
[mshtml.dll ip=0x7CCF0F72]
Also I loop test the code that responsible for loading the html and I found
from the Window Task Manager that each time the memory increases more first
and later it decreases but not to the initial level.
Ex : Memory before the code ˇV 100 K
After the Call ˇV 300K
And Later it comes down to 200K.
Here is a sample of the loop test I did. Is there any function I can call to
make sure that resource loaded are released properly? Or could the memory
increase due to another factor? I am using VC++ .NET and Window XP
Professional ver.2002 SP1 and mshtml.dll (ver. 6.0.2800.1106).
CENTRANCEDlg ent_dialog;
..
..
..
class CENTRANCEDlg : public CDHtmlDialog
..
..
..
//helper function inside the CENTRANCEDlg class
BOOL CENTRANCEDlg::LoadFromResource2( int id )
{
try
{
BOOL result = LoadFromResource(id);
Sleep(300);
}
catch (...)
{
}
return S_OK;
}
// loop testing the function
for(int i=0; i<10000; i++)
{
ent_dialog.LoadFromResource2(IDR_HTML_PF_ENTER);
}
Thank you very much.
Joe