Memory leakage !!

S

Sirria

I have placed MS comm control on Test dialog, While initiate the dialog it
is occupying around 2MB space, I am unable to free this space. I am giving
the snippets of the code.

MSComm m_ctlComm;

m_ctlComm.SetCommPort(1);

m_ctlComm.SetInBufferSize(1024);

m_ctlComm.SetOutBufferSize(512);

m_ctlComm.SetSettings("9600,n,8,1");

m_ctlComm.SetInputMode(1);//0 - Text and 1 - Binary.

m_ctlComm.SetRThreshold(0);// To Raise OnCommEvent() method.

m_ctlComm.SetSThreshold(0);

try

{

m_ctlComm.SetPortOpen(TRUE);

}

catch(CException* e)

{

AfxMessageBox("Port is already open. ",MB_ICONSTOP);

return FALSE;

}

After executing this code, it was occupying aroung 2MB space, and I am
unable to release this space, even after closing the dialog in SDI
application. Can you help me to release these memory?

Thanks in advance,
 
J

Jagadeesh VN

I have read somewhere about MSComm control creating an extra copy of data
when GetInput(...) is invoked, and that can be solved by using Attach method
of COleVariant.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top