How can I release the memory after data received?
Here is my pseudo code, very similar to C++ COM API sample:
CComPtr<IAdxRtList> m_RtMgr;
...CreateAdxRtList((IUnknown **)&m_RtMgr);
CComQIPtr<IConnectionPointContainer> l_connectionPointContainer(m_RtMgr);
if (l_connectionPointContainer)
{
l_hr = l_connectionPointContainer->FindConnectionPoint(__uuidof(IAdxRtListEvents),
&m_RtDataConnectionPoint);
if (l_hr == S_OK)
{
l_hr = m_RtDataConnectionPoint->Advise(&m_RtDataEventHandler, &m_RtDataEventHandlerCookie);
if (l_hr == S_OK)
{
// LOG. RtMgr initialized...
}
}
}
...
m_RtMgr->get_ListStatus(&a_listStatus);
if (a_listStatus == RT_LIST_RUNNING)
{
m_RtMgr->StopUpdates();
m_RtMgr->UnregisterAllItems();
}
l_hr = m_RtMgr->put_Source(BSTR(a_Source));
l_hr = m_RtMgr->RegisterItems(_variant_t(a_Instrument), _variant_t(a_FieldList));
HRESULT l_hr = m_RtMgr->StartUpdates(RT_MODE_IMAGE);
// When response is received:
HRESULT l_hr = m_RtMgr->get_ListItems(RT_IRV_ALL, RT_ICV_STATUS, &m_comData);
After results is parse, I run another query started from StopUpdates()...
Every request adds about 40mb to the memory usage. Is there a way to clean it up before next request?
Thanks.