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

Re: [reSIProcate] Memory leaks in SipStack::send(.) and SipStack::post(.) ?


Looking at these traces, it appears that the stack has been shut down before it has had a chance to clear out its message queues/timer heap. If you still have DEBUG-level logging for this, I can give it a look.

Best regards,
Byron Campen

Hi there!

We make use of resiprocate 1.0.3 in our application, and notice that there are a number of memory leaks for each SIP call, which might be due to our application, or due to the sip stack.

To help to locate the memory leaks, we run our application with a modified version of “malloc” library, which traces all the memory allocation/freeing. Below are the memory leaks in one test scenario (a SIP phone calls another one, which rings for a few seconds, then the call is cancelled).

From the trace, it seems that the memory chunks allocated in SipStack::send(…) and SipStack::post(…), among other things, have not been freed. Ive already looked through the source codes, but Im not able to tell from what Ive seen if these are true memory leaks in the SIP stack, or it is rather because we forget to call a suitable destructor in our application.

So help appreciated.

Regards,

Shaofeng


Below are some of the memory allocations that are not freed (complete memory dumps in attached file):

<<malloc_dump_001.txt>>

malloc(47 bytes): 0x402227f8<_Znwj+0x6c>(/usr/lib/libstdc++.so.6)

        0x40222aa8<_Znaj+0x68>(/usr/lib/libstdc++.so.6)

        0x568de8<_ZN5resip4DataC1ERKS0_+0x68>

        0x403a9c<_ZN5resip16MergedRequestKeyC1ERKS0_+0xa8>

        0x403798<_ZN5resip27MergedRequestRemovalCommandC1ERKS0_+0xd0>

        0x4038b0<_ZNK5resip27MergedRequestRemovalCommand5cloneEv+0x7c>

        0x4fc524<_ZN5resip8SipStack6postMSERKNS_18ApplicationMessageEjPNS_15TransactionUserE+0xa0>

        0x372fec<_ZN5resip18DialogUsageManager27requestMergedRequestRemovalERKNS_16MergedRequestKeyE+0x10c>

        0x36c6a0<_ZN5resip9DialogSetD0Ev+0x6e0>

        0x42a074<_ZN5resip12DestroyUsage7destroyEv+0x164>

        0x388124<_ZN5resip18DialogUsageManager15internalProcessESt8auto_ptrINS_7MessageEE+0x14c>

        0x388a68<_ZN5resip18DialogUsageManager7processEv+0xac>

        0x316380<proc_iws_dum+0x18c>

malloc(76 bytes): 0x402227f8<_Znwj+0x6c>(/usr/lib/libstdc++.so.6)

        0x503a10<_ZNSt8_Rb_treeIN5resip5TimerES1_St9_IdentityIS1_ESt4lessIS1_ESaIS1_EE9_M_insertEPSt18_Rb_tree_node_baseS9_RKS1_+0x74>

        0x503b9c<_ZNSt8_Rb_treeIN5resip5TimerES1_St9_IdentityIS1_ESt4lessIS1_ESaIS1_EE12insert_equalERKS1_+0x68>

        0x503128<_ZN5resip23BaseTimeLimitTimerQueue3addERKNS_5TimerE+0x110>

        0x4fc588<_ZN5resip8SipStack6postMSERKNS_18ApplicationMessageEjPNS_15TransactionUserE+0x104>

        0x372fec<_ZN5resip18DialogUsageManager27requestMergedRequestRemovalERKNS_16MergedRequestKeyE+0x10c>

        0x36c6a0<_ZN5resip9DialogSetD0Ev+0x6e0>

        0x42a074<_ZN5resip12DestroyUsage7destroyEv+0x164>

        0x388124<_ZN5resip18DialogUsageManager15internalProcessESt8auto_ptrINS_7MessageEE+0x14c>

        0x388a68<_ZN5resip18DialogUsageManager7processEv+0xac>

        0x316380<proc_iws_dum+0x18c>

malloc(76 bytes): 0x402227f8<_Znwj+0x6c>(/usr/lib/libstdc++.so.6)

        0x503a10<_ZNSt8_Rb_treeIN5resip5TimerES1_St9_IdentityIS1_ESt4lessIS1_ESaIS1_EE9_M_insertEPSt18_Rb_tree_node_baseS9_RKS1_+0x74>

        0x503b9c<_ZNSt8_Rb_treeIN5resip5TimerES1_St9_IdentityIS1_ESt4lessIS1_ESaIS1_EE12insert_equalERKS1_+0x68>

        0x503128<_ZN5resip23BaseTimeLimitTimerQueue3addERKNS_5TimerE+0x110>

        0x4fc588<_ZN5resip8SipStack6postMSERKNS_18ApplicationMessageEjPNS_15TransactionUserE+0x104>

        0x372654<_ZN5resip18DialogUsageManager8addTimerENS_10DumTimeout4TypeEmNS_6HandleINS_9BaseUsageEEEjj+0xc8>

        0x3d0258<_ZN5resip19ServerInviteSession23startRetransmit1xxTimerEv+0x130>

        0x3d0928<_ZN5resip19ServerInviteSession15sendProvisionalEiPc+0xf0>

        0x3d1af8<_ZN5resip19ServerInviteSession11provisionalEiPc+0xf8>

        0x324cd4<_Z20iws_EsigTrIpNewSessAP12TERM_CONTEXTP15IWST_SIG_MSG_UC+0x160>

        0x327e44<_Z19iws_EsigTrWaitMediaP12TERM_CONTEXTh+0x45c>

        0x320388<_Z16iws_MedTrIpOfferP12TERM_CONTEXTP15IWST_SIG_MSG_UC+0x198>

        0x325148<_Z18iws_EsigTraitIpMsgP13IWSST_DUM_MSGP12TERM_CONTEXTP15IWST_SIG_MSG_UC+0x210>

        0x31c7cc<proc_iws_ctrl+0x800>

malloc(76 bytes): 0x402227f8<_Znwj+0x6c>(/usr/lib/libstdc++.so.6)

        0x503a10<_ZNSt8_Rb_treeIN5resip5TimerES1_St9_IdentityIS1_ESt4lessIS1_ESaIS1_EE9_M_insertEPSt18_Rb_tree_node_baseS9_RKS1_+0x74>

        0x503b9c<_ZNSt8_Rb_treeIN5resip5TimerES1_St9_IdentityIS1_ESt4lessIS1_ESaIS1_EE12insert_equalERKS1_+0x68>

        0x503128<_ZN5resip23BaseTimeLimitTimerQueue3addERKNS_5TimerE+0x110>

        0x4fc588<_ZN5resip8SipStack6postMSERKNS_18ApplicationMessageEjPNS_15TransactionUserE+0x104>

        0x372654<_ZN5resip18DialogUsageManager8addTimerENS_10DumTimeout4TypeEmNS_6HandleINS_9BaseUsageEEEjj+0xc8>

        0x3d0258<_ZN5resip19ServerInviteSession23startRetransmit1xxTimerEv+0x130>

        0x3d0928<_ZN5resip19ServerInviteSession15sendProvisionalEiPc+0xf0>

        0x3d1af8<_ZN5resip19ServerInviteSession11provisionalEiPc+0xf8>

        0x325738<_Z17iws_EsigTrUcAlertP12TERM_CONTEXTP15IWST_SIG_MSG_UC+0x124>

        0x328564<_Z18iws_EsigTraitUcMsgP6SIGNAL+0x2bc>

        0x31c3ec<proc_iws_ctrl+0x420>

malloc(708 bytes): 0x402227f8<_Znwj+0x6c>(/usr/lib/libstdc++.so.6)

        0x4fbda8<_ZN5resip8SipStack4sendERKNS_10SipMessageEPNS_15TransactionUserE+0xf4>

        0x382a8c<_ZN5resip18DialogUsageManager15outgoingProcessESt8auto_ptrINS_7MessageEE+0xf1c>

        0x38396c<_ZN5resip18DialogUsageManager4sendENS_9SharedPtrINS_10SipMessageEEE+0x5b4>

        0x356ff8<_ZN5resip6Dialog4sendENS_9SharedPtrINS_10SipMessageEEE+0x1ec>

        0x371800<_ZN5resip11DialogUsage4sendENS_9SharedPtrINS_10SipMessageEEE+0xc4>

        0x3d4d84<_ZN5resip19ServerInviteSession14dispatchCancelERKNS_10SipMessageE+0x388>

        0x3d57b0<_ZN5resip19ServerInviteSession20dispatchOfferOrEarlyERKNS_10SipMessageE+0x138>

        0x358334<_ZN5resip6Dialog8dispatchERKNS_10SipMessageE+0xc28>

        0x36004c<_ZN5resip9DialogSet20dispatchToAllDialogsERKNS_10SipMessageE+0x48>

        0x366e70<_ZN5resip9DialogSet8dispatchERKNS_10SipMessageE+0x29bc>

        0x385e50<_ZN5resip18DialogUsageManager14processRequestERKNS_10SipMessageE+0x73c>

        0x387d8c<_ZN5resip18DialogUsageManager15incomingProcessESt8auto_ptrINS_7MessageEE+0x8a0>

        0x388704<_ZN5resip18DialogUsageManager15internalProcessESt8auto_ptrINS_7MessageEE+0x72c>

        0x388a68<_ZN5resip18DialogUsageManager7processEv+0xac>

malloc(16 bytes): 0x402227f8<_Znwj+0x6c>(/usr/lib/libstdc++.so.6)

        0x4da698<_ZN5resip10SipMessageaSERKS0_+0x220>

        0x4dad70<_ZN5resip10SipMessageC1ERKS0_+0x1a8>

        0x4fbdbc<_ZN5resip8SipStack4sendERKNS_10SipMessageEPNS_15TransactionUserE+0x108>

        0x382a8c<_ZN5resip18DialogUsageManager15outgoingProcessESt8auto_ptrINS_7MessageEE+0xf1c>

        0x38396c<_ZN5resip18DialogUsageManager4sendENS_9SharedPtrINS_10SipMessageEEE+0x5b4>

        0x356ff8<_ZN5resip6Dialog4sendENS_9SharedPtrINS_10SipMessageEEE+0x1ec>

        0x371800<_ZN5resip11DialogUsage4sendENS_9SharedPtrINS_10SipMessageEEE+0xc4>

        0x3d4d84<_ZN5resip19ServerInviteSession14dispatchCancelERKNS_10SipMessageE+0x388>

        0x3d57b0<_ZN5resip19ServerInviteSession20dispatchOfferOrEarlyERKNS_10SipMessageE+0x138>

        0x358334<_ZN5resip6Dialog8dispatchERKNS_10SipMessageE+0xc28>

        0x36004c<_ZN5resip9DialogSet20dispatchToAllDialogsERKNS_10SipMessageE+0x48>

        0x366e70<_ZN5resip9DialogSet8dispatchERKNS_10SipMessageE+0x29bc>

        0x385e50<_ZN5resip18DialogUsageManager14processRequestERKNS_10SipMessageE+0x73c>

        0x387d8c<_ZN5resip18DialogUsageManager15incomingProcessESt8auto_ptrINS_7MessageEE+0x8a0>

malloc(1 bytes): 0x402227f8<_Znwj+0x6c>(/usr/lib/libstdc++.so.6)

        0x5574b8<_ZN5resip20HeaderFieldValueListC1ERKS0_+0x88>

        0x4da6b0<_ZN5resip10SipMessageaSERKS0_+0x238>

        0x4dad70<_ZN5resip10SipMessageC1ERKS0_+0x1a8>

        0x4fbdbc<_ZN5resip8SipStack4sendERKNS_10SipMessageEPNS_15TransactionUserE+0x108>

        0x382a8c<_ZN5resip18DialogUsageManager15outgoingProcessESt8auto_ptrINS_7MessageEE+0xf1c>

        0x38396c<_ZN5resip18DialogUsageManager4sendENS_9SharedPtrINS_10SipMessageEEE+0x5b4>

        0x356ff8<_ZN5resip6Dialog4sendENS_9SharedPtrINS_10SipMessageEEE+0x1ec>

        0x371800<_ZN5resip11DialogUsage4sendENS_9SharedPtrINS_10SipMessageEEE+0xc4>

        0x3d4d84<_ZN5resip19ServerInviteSession14dispatchCancelERKNS_10SipMessageE+0x388>

        0x3d57b0<_ZN5resip19ServerInviteSession20dispatchOfferOrEarlyERKNS_10SipMessageE+0x138>

        0x358334<_ZN5resip6Dialog8dispatchERKNS_10SipMessageE+0xc28>

        0x36004c<_ZN5resip9DialogSet20dispatchToAllDialogsERKNS_10SipMessageE+0x48>

        0x366e70<_ZN5resip9DialogSet8dispatchERKNS_10SipMessageE+0x29bc>

        0x385e50<_ZN5resip18DialogUsageManager14processRequestERKNS_10SipMessageE+0x73c>

malloc(20 bytes): 0x402227f8<_Znwj+0x6c>(/usr/lib/libstdc++.so.6)

        0x463ec0<_ZNK5resip15ParserContainerINS_3ViaEE5cloneEv+0x68>

        0x557614<_ZN5resip20HeaderFieldValueListC1ERKS0_+0x1e4>

        0x4da6b0<_ZN5resip10SipMessageaSERKS0_+0x238>

        0x4dad70<_ZN5resip10SipMessageC1ERKS0_+0x1a8>

        0x4fbdbc<_ZN5resip8SipStack4sendERKNS_10SipMessageEPNS_15TransactionUserE+0x108>

        0x382a8c<_ZN5resip18DialogUsageManager15outgoingProcessESt8auto_ptrINS_7MessageEE+0xf1c>

        0x38396c<_ZN5resip18DialogUsageManager4sendENS_9SharedPtrINS_10SipMessageEEE+0x5b4>

        0x356ff8<_ZN5resip6Dialog4sendENS_9SharedPtrINS_10SipMessageEEE+0x1ec>

        0x371800<_ZN5resip11DialogUsage4sendENS_9SharedPtrINS_10SipMessageEEE+0xc4>

        0x3d4d84<_ZN5resip19ServerInviteSession14dispatchCancelERKNS_10SipMessageE+0x388>

        0x3d57b0<_ZN5resip19ServerInviteSession20dispatchOfferOrEarlyERKNS_10SipMessageE+0x138>

        0x358334<_ZN5resip6Dialog8dispatchERKNS_10SipMessageE+0xc28>

        0x36004c<_ZN5resip9DialogSet20dispatchToAllDialogsERKNS_10SipMessageE+0x48>

        0x366e70<_ZN5resip9DialogSet8dispatchERKNS_10SipMessageE+0x29bc>

malloc(188 bytes): 0x402227f8<_Znwj+0x6c>(/usr/lib/libstdc++.so.6)

        0x4393dc<_ZNK5resip3Via5cloneEv+0x68>

        0x4a8304<_ZN5resip19ParserContainerBaseC2ERKS0_+0xe0>

        0x463ed8<_ZNK5resip15ParserContainerINS_3ViaEE5cloneEv+0x80>

        0x557614<_ZN5resip20HeaderFieldValueListC1ERKS0_+0x1e4>

        0x4da6b0<_ZN5resip10SipMessageaSERKS0_+0x238>

        0x4dad70<_ZN5resip10SipMessageC1ERKS0_+0x1a8>

        0x4fbdbc<_ZN5resip8SipStack4sendERKNS_10SipMessageEPNS_15TransactionUserE+0x108>

        0x382a8c<_ZN5resip18DialogUsageManager15outgoingProcessESt8auto_ptrINS_7MessageEE+0xf1c>

        0x38396c<_ZN5resip18DialogUsageManager4sendENS_9SharedPtrINS_10SipMessageEEE+0x5b4>

        0x356ff8<_ZN5resip6Dialog4sendENS_9SharedPtrINS_10SipMessageEEE+0x1ec>

        0x371800<_ZN5resip11DialogUsage4sendENS_9SharedPtrINS_10SipMessageEEE+0xc4>

        0x3d4d84<_ZN5resip19ServerInviteSession14dispatchCancelERKNS_10SipMessageE+0x388>

        0x3d57b0<_ZN5resip19ServerInviteSession20dispatchOfferOrEarlyERKNS_10SipMessageE+0x138>

        0x358334<_ZN5resip6Dialog8dispatchERKNS_10SipMessageE+0xc28>

malloc(92 bytes): 0x402227f8<_Znwj+0x6c>(/usr/lib/libstdc++.so.6)

        0x43ca3c<_ZNK5resip15BranchParameter5cloneEv+0x68>

        0x4a6ef8<_ZN5resip14ParserCategory18copyParametersFromERKS0_+0x48>

        0x4a725c<_ZN5resip14ParserCategoryC2ERKS0_+0xd4>

        0x4391c8<_ZN5resip3ViaC1ERKS0_+0x70>

        0x4393f0<_ZNK5resip3Via5cloneEv+0x7c>

        0x4a8304<_ZN5resip19ParserContainerBaseC2ERKS0_+0xe0>

        0x463ed8<_ZNK5resip15ParserContainerINS_3ViaEE5cloneEv+0x80>

        0x557614<_ZN5resip20HeaderFieldValueListC1ERKS0_+0x1e4>

        0x4da6b0<_ZN5resip10SipMessageaSERKS0_+0x238>

        0x4dad70<_ZN5resip10SipMessageC1ERKS0_+0x1a8>

        0x4fbdbc<_ZN5resip8SipStack4sendERKNS_10SipMessageEPNS_15TransactionUserE+0x108>

        0x382a8c<_ZN5resip18DialogUsageManager15outgoingProcessESt8auto_ptrINS_7MessageEE+0xf1c>

        0x38396c<_ZN5resip18DialogUsageManager4sendENS_9SharedPtrINS_10SipMessageEEE+0x5b4>

        0x356ff8<_ZN5resip6Dialog4sendENS_9SharedPtrINS_10SipMessageEEE+0x1ec>

malloc(4 bytes): 0x402227f8<_Znwj+0x6c>(/usr/lib/libstdc++.so.6)

        0x33ff7c<_ZNSt6vectorIPN5resip14ParserCategoryESaIS2_EE13_M_insert_auxEN9__gnu_cxx17__normal_iteratorIPS2_S4_EERKS2_+0x80>

        0x4a83bc<_ZN5resip19ParserContainerBaseC2ERKS0_+0x198>

        0x463ed8<_ZNK5resip15ParserContainerINS_3ViaEE5cloneEv+0x80>

        0x557614<_ZN5resip20HeaderFieldValueListC1ERKS0_+0x1e4>

        0x4da6b0<_ZN5resip10SipMessageaSERKS0_+0x238>

        0x4dad70<_ZN5resip10SipMessageC1ERKS0_+0x1a8>

        0x4fbdbc<_ZN5resip8SipStack4sendERKNS_10SipMessageEPNS_15TransactionUserE+0x108>

        0x382a8c<_ZN5resip18DialogUsageManager15outgoingProcessESt8auto_ptrINS_7MessageEE+0xf1c>

        0x38396c<_ZN5resip18DialogUsageManager4sendENS_9SharedPtrINS_10SipMessageEEE+0x5b4>

        0x356ff8<_ZN5resip6Dialog4sendENS_9SharedPtrINS_10SipMessageEEE+0x1ec>

        0x371800<_ZN5resip11DialogUsage4sendENS_9SharedPtrINS_10SipMessageEEE+0xc4>

        0x3d4d84<_ZN5resip19ServerInviteSession14dispatchCancelERKNS_10SipMessageE+0x388>

        0x3d57b0<_ZN5resip19ServerInviteSession20dispatchOfferOrEarlyERKNS_10SipMessageE+0x138>

        0x358334<_ZN5resip6Dialog8dispatchERKNS_10SipMessageE+0xc28>

malloc(4 bytes): 0x402227f8<_Znwj+0x6c>(/usr/lib/libstdc++.so.6)

        0x33ff7c<_ZNSt6vectorIPN5resip14ParserCategoryESaIS2_EE13_M_insert_auxEN9__gnu_cxx17__normal_iteratorIPS2_S4_EERKS2_+0x80>

        0x4a83bc<_ZN5resip19ParserContainerBaseC2ERKS0_+0x198>

        0x4fb508<_ZNK5resip15ParserContainerINS_10StatusLineEE5cloneEv+0x80>

        0x557614<_ZN5resip20HeaderFieldValueListC1ERKS0_+0x1e4>

        0x4daa5c<_ZN5resip10SipMessageaSERKS0_+0x5e4>

        0x4dad70<_ZN5resip10SipMessageC1ERKS0_+0x1a8>

        0x4fbdbc<_ZN5resip8SipStack4sendERKNS_10SipMessageEPNS_15TransactionUserE+0x108>

        0x382a8c<_ZN5resip18DialogUsageManager15outgoingProcessESt8auto_ptrINS_7MessageEE+0xf1c>

        0x38396c<_ZN5resip18DialogUsageManager4sendENS_9SharedPtrINS_10SipMessageEEE+0x5b4>

        0x356ff8<_ZN5resip6Dialog4sendENS_9SharedPtrINS_10SipMessageEEE+0x1ec>

        0x371800<_ZN5resip11DialogUsage4sendENS_9SharedPtrINS_10SipMessageEEE+0xc4>

        0x3d4d84<_ZN5resip19ServerInviteSession14dispatchCancelERKNS_10SipMessageE+0x388>

        0x3d57b0<_ZN5resip19ServerInviteSession20dispatchOfferOrEarlyERKNS_10SipMessageE+0x138>

        0x358334<_ZN5resip6Dialog8dispatchERKNS_10SipMessageE+0xc28>


<malloc_dump_001.txt>
_______________________________________________
resiprocate-devel mailing list