Arthur Shats | David, Whe you say to review our statistics code for memory leask, this would be very simple, because there are only few lines of code I added to the C++Phone sample app. Here they are: In the EvenSink.cpp, in the OnSetAgentModeEvent, where it sets agentID, password, instrument and peripheralID before doing the actual login, I added 3 lines to enable remote login: arLoginReq.AddItem(CTIOS_REMOTELOGIN, "true"); arLoginReq.AddItem(CTIOS_AGENTREMOTENUMBER, "1234567890"); arLoginReq.AddItem(CTIOS_AGENTCALLMODE, 3); then it does m_pCtiAgent->Login(arLoginReq); and arLoginReq.Release(); I didn't touch these lines. Then in OnQueryAgentStateConf, I added a call to enable stats: Arguments &skillGrpParam = Arguments::CreateInstance(); rc = m_pCtiAgent->EnableSkillGroupStatistics(skillGrpParam); unsigned long rcode = skillGrpParam.Release(); //and when I print rcode, it's 0, so all is good. And then I add OnSkillGroupStatisticsUpdated event with no code in it. When I execute with the above code, there is no memory leak, memory usage doesn't increase. The memory leak starts when in OnSkillGroupStatisticsUpdated, I add the following: Arguments &stats = Arguments::CreateInstance(); stats = rArguments.GetValueArray("Statistics"); unsigned long rcode = stats.Release(); //rcode here returns 2; even when I call .Release() twice so it rcode does become 0, the next time the event is called I get rcode of 2 again. And the memory usage keeps increasing. So as you can see, there is very little code I added, and the leak seem to start only after the last two .CreateInstance and .GetValueArray. So where am I doing something wrong? I am using the methods that are part of the SDK. Thanks. p.s. Do you have the actual COM code that you used to get stats? Is my C++ equivalent is similar to your COM, or am I missing something. Could you send me the lines you added in COM... if you can? Thanks. |