Please help!!!
Has anyone noticed that there is a memory leak in GetInput() function of MSComm? Consider the following code (assume that connection already existed and is working fine):
COleVariant ovData;
for (int i=0; i<500000; i++)
{
ovData = m_mcComm1.GetInput();
}
I noticed that everytime when I executed the above code, my PC's memory usage will increase about 10 MB (I got the memory usage information from Windows Task Manager).
So, after several round of testing, I decided to add a new line of code after GetInput() to free the memory occupied:
COleVariant ovData;
for (int i=0; i<500000; i++)
{
ovData = m_mcComm1.GetInput();
SysFreeString(ovData.bstrVal);
}
This help to reduce the memory leak, but it still happen (increase about 4K - 10K everytime the code is executed).
I wonder is it something to do with my code, or I have missed out some important setting for MSComm, or is it a bug in GetInput() function?
Your help is very much appreciated. Many thanks.
Has anyone noticed that there is a memory leak in GetInput() function of MSComm? Consider the following code (assume that connection already existed and is working fine):
COleVariant ovData;
for (int i=0; i<500000; i++)
{
ovData = m_mcComm1.GetInput();
}
I noticed that everytime when I executed the above code, my PC's memory usage will increase about 10 MB (I got the memory usage information from Windows Task Manager).
So, after several round of testing, I decided to add a new line of code after GetInput() to free the memory occupied:
COleVariant ovData;
for (int i=0; i<500000; i++)
{
ovData = m_mcComm1.GetInput();
SysFreeString(ovData.bstrVal);
}
This help to reduce the memory leak, but it still happen (increase about 4K - 10K everytime the code is executed).
I wonder is it something to do with my code, or I have missed out some important setting for MSComm, or is it a bug in GetInput() function?
Your help is very much appreciated. Many thanks.