< Previous by Date Date Index Next by Date >
  Thread Index Next in Thread >

[reSIProcate-users] Memory Leak


I am having a tough time tracking down a memory leak in my application and was wonder if anyone could offer any insight. I am wondering with calls to getContents/setContentcs in a SipMessage is there any cleanup that I should be doing myself, or should said functions just be returning pointers internally that are cleaned up with the message. The output from Valgrind as well as Devpartner Studio seems to point to these calls, for example:
 
==15231== 13,354,247 (971,600 direct, 12,382,647 indirect) bytes in 3,470 blocks are definitely lost in loss record 25 of 144
==15231==    at 0x4005B65: operator new(unsigned) (vg_replace_malloc.c:163)
==15231==    by 0x83BB52D: std::list<resip::SdpContents::Session::Medium, std::allocator<resip::SdpContents::Session::Medium> >::operator=(std::list<resip::SdpContents::Session::Medium, std::allocator<resip::SdpContents::Session::Medium> > const&) (in /home/tmortime/AppCritical/cpp/bin/platform/linux-rh5/netseq-linux)
==15231==    by 0x83B4B8F: resip::SdpContents::Session::operator=(resip::SdpContents::Session const&) (in /home/tmortime/AppCritical/cpp/bin/platform/linux-rh5/netseq-linux)
==15231==    by 0x83B505D: resip::SdpContents::Session::Session(resip::SdpContents::Session const&) (in /home/tmortime/AppCritical/cpp/bin/platform/linux-rh5/netseq-linux)
==15231==    by 0x83B54A6: resip::SdpContents::clone() const (in /home/tmortime/AppCritical/cpp/bin/platform/linux-rh5/netseq-linux)
==15231==    by 0x83CC40A: resip::SipMessage::setContents(resip::Contents const*) (in /home/tmortime/AppCritical/cpp/bin/platform/linux-rh5/netseq-linux)
==15231==    by 0x80FC039: SipSignaling::createResponse(resip::SipMessage*, resip::SdpContents*, unsigned, SipDialogs::DialogInfo*, bool) (SIP.cpp:1180)
==15231==    by 0x80FD025: SipSignaling::sendResponse(resip::SipMessage*, resip::SdpContents*, IOBuffer*, unsigned, SipDialogs::DialogInfo*, bool) (SIP.cpp:1160)
==15231==    by 0x8107CB3: SipSignaling::processRequest(resip::SipMessage*, IOBuffer*) (SIP.cpp:566)
==15231==    by 0x8108DBD: SipSignaling::onReceive(IOBuffer*) (SIP.cpp:257)
==15231==    by 0x812C372: AsyncIO::processPackets() (AsyncIO.cpp:299)
==15231==    by 0x80D4B95: AsyncManager::onTimeout() (AsyncManager.cpp:97)
 
and
 
==15231== 788,432 (169,692 direct, 618,740 indirect) bytes in 179 blocks are definitely lost in loss record 53 of 144
==15231==    at 0x4005B65: operator new(unsigned) (vg_replace_malloc.c:163)
==15231==    by 0x83BACA7: resip::ContentsFactory<resip::SdpContents>::create(resip::HeaderFieldValue*, resip::Mime const&) const (in /home/tmortime/AppCritical/cpp/bin/platform/linux-rh5/netseq-linux)
==15231==    by 0x83CE330: resip::SipMessage::getContents() const (in /home/tmortime/AppCritical/cpp/bin/platform/linux-rh5/netseq-linux)
==15231==    by 0x8107AA3: SipSignaling::processRequest(resip::SipMessage*, IOBuffer*) (SIP.cpp:532)
==15231==    by 0x8108DBD: SipSignaling::onReceive(IOBuffer*) (SIP.cpp:257)
==15231==    by 0x812C372: AsyncIO::processPackets() (AsyncIO.cpp:299)
==15231==    by 0x80D4B95: AsyncManager::onTimeout() (AsyncManager.cpp:97)
==15231==    by 0x82D8255: APN::Task::iterate() (Task.cpp:207)
==15231==    by 0x82D7EAB: APN::Task::svc() (Task.cpp:112)
==15231==    by 0x8422E79: ACE_Task_Base::svc_run(void*) (in /home/tmortime/AppCritical/cpp/bin/platform/linux-rh5/netseq-linux)
==15231==    by 0x8435957: ACE_Thread_Adapter::invoke() (in /home/tmortime/AppCritical/cpp/bin/platform/linux-rh5/netseq-linux)
==15231==    by 0x40212DA: start_thread (in /lib/libpthread-2.5.so)
 
Also we are (miss)using the sdp to send extra application specific info, as so:
 
SdpContents::Session session;
SdpContents::Session::Medium medium;
APN::ChString code;
APN::ChString state;
code.format (64, "%d", msg->errorCode ());
medium.addAttribute ("X-ErrorCode", code.c_str ());
state.format (64, "%d", sipState);
medium.addAttribute ("X-State", state.c_str ());
medium.addAttribute ("X-Comment", msg->comment ().c_str ());
medium.addAttribute ("X-MoreInfo", msg->moreInfo ().c_str ());
session.addMedium (medium);
sdp.session () = session;
 
and it doesnt seem to much like the "sdp.session () = session;" call:
 

==15231== 5,318,043 (50,072 direct, 5,267,971 indirect) bytes in 1,138 blocks are definitely lost in loss record 46 of 144
==15231==    at 0x4005B65: operator new(unsigned) (vg_replace_malloc.c:163)
==15231==    by 0x83B13C4: resip::SdpContents::Session::Medium::parse(resip::ParseBuffer&) (in /home/tmortime/AppCritical/cpp/bin/platform/linux-rh5/netseq-linux)
==15231==    by 0x83B4672: resip::SdpContents::Session::parse(resip::ParseBuffer&) (in /home/tmortime/AppCritical/cpp/bin/platform/linux-rh5/netseq-linux)
==15231==    by 0x8387726: resip::LazyParser::checkParsed() const (in /home/tmortime/AppCritical/cpp/bin/platform/linux-rh5/netseq-linux)
==15231==    by 0x8107AD6: SipSignaling::processRequest(resip::SipMessage*, IOBuffer*) (SdpContents.hxx:515)
==15231==    by 0x8108DBD: SipSignaling::onReceive(IOBuffer*) (SIP.cpp:257)
==15231==    by 0x812C372: AsyncIO::processPackets() (AsyncIO.cpp:299)
==15231==    by 0x80D4B95: AsyncManager::onTimeout() (AsyncManager.cpp:97)
==15231==    by 0x82D8255: APN::Task::iterate() (Task.cpp:207)
==15231==    by 0x82D7EAB: APN::Task::svc() (Task.cpp:112)
==15231==    by 0x8422E79: ACE_Task_Base::svc_run(void*) (in /home/tmortime/AppCritical/cpp/bin/platform/linux-rh5/netseq-linux)
==15231==    by 0x8435957: ACE_Thread_Adapter::invoke() (in /home/tmortime/AppCritical/cpp/bin/platform/linux-rh5/netseq-linux)
 
If anyone can offer any insight as to what I might be doing wrong here, that would be grand!
 
Thanks,
-Tom
 
 
 

Thomas Mortimer
Software Developer
Apparent Networks
tmortimer@xxxxxxxxxxxxxxxxxxxx
www.apparentnetworks.com

Tel: 604.433.2333 ext 132
Cel: 778.772.6957

400 - 321 Water Street
Vancouver, BC V6B 1B8
Tel.1.800.508.5233 Fax. 604.433.2311
Winner: Deloitte Technology Fast 50 Companies to Watch